Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
p33c_pwm.h
1 /*
2  (c) 2019 Microchip Technology Inc. and its subsidiaries. You may use this
3  software and any derivatives exclusively with Microchip products.
4 
5  THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
6  EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
7  WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
8  PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
9  WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
10 
11  IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
12  INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
13  WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
14  BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
15  FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
16  ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
17  THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
18 
19  MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
20  TERMS.
21 */
22 
23 /*@@p33c_pwm.h
24  * ************************************************************************************************
25  * Summary:
26  * Generic High-Speed SMPS PWM Driver Module & Generator Instances (header file)
27  *
28  * Description:
29  * This additional header file contains defines for all required bit-settings of all related
30  * special function registers of a peripheral module and/or instance.
31  * This file is an additional header file on top of the generic device header file.
32  *
33  * See Also:
34  * p33c_pwm.c
35  *
36  * ***********************************************************************************************#
37  * Revision history:
38  * 06/22/20 1.0 initial release
39  * 09/16/20 1.1 Simplified module and generator addressing
40  * ***********************************************************************************************/
41 
42 // This is a guard condition so that contents of this file are not included
43 // more than once.
44 #ifndef P33C_PWM_SFR_ABSTRACTION_H
45 #define P33C_PWM_SFR_ABSTRACTION_H
46 
47 // Include standard header files
48 #include <xc.h> // include processor files - each processor file is guarded.
49 #include <stdint.h> // include standard integer data types
50 #include <stdbool.h> // include standard boolean data types
51 #include <stddef.h> // include standard definition data types
52 
53 //#ifndef __dsPIC33C__
54 // #error "peripheral driver p33c_pwm.h does not support the selected device"
55 //#endif
56 
57 
58 /* GENERIC SPECIAL FUNCTION REGISTER (SFR) SETS
59  * ============================================
60  *
61  * Direct addressing of Special Function Registers (SFR) in user code is good
62  * enough for a specific application but makes it harder to maintain the code
63  * or migrate the code across devices and applications.
64  *
65  * Especially with complex configurations with multiple dependencies across various
66  * peripherals, migrating configurations can become very challenging to review,
67  * debug and migrate.
68  *
69  * Therefore this PWM configuration example uses a 'virtual PWM generator' to set up
70  * the required PWM configuration but provides a function allowing users to write this
71  * configuration to any PWM generator of choice. Hence, pre-defined configurations
72  * can be mapped on specific peripheral instance by using their index defined by the
73  * data sheet (e.g. pgInstance = 1 maps pre-defined configuration to PG1)
74  *
75  * The data types used for each SFR in the P33C_PWM_GENERATOR_t data structure below,
76  * are data types declared in the common C-header file of the device (e.g. <d33CK256MP506.h>).
77  * These header files are provided with the XC16 C-Compiler installation and don't have to be
78  * written nor changed manually.
79  *
80  */
81 
82 // GENERIC PWM MODULE SPECIAL FUNCTION REGISTER SET
83 
84 #ifndef P33C_PWM_MODULE_s
85 
86  typedef struct P33C_PWM_MODULE_s {
87 
88  union {
89  struct tagPCLKCONBITS bits; // Register bit-field
90  uint16_t value; // 16-bit wide register value
91  } vPCLKCON; // PCLKCON: PWM CLOCK CONTROL REGISTER
92  union {
93  struct {
94  uint16_t FSCL : 16; // Register bit-field
95  } bits; // Register bit-field
96  uint16_t value; // 16-bit wide register value
97  } vFSCL; // FSCL: FREQUENCY SCALE REGISTER
98  union {
99  struct {
100  uint16_t FSMINPER : 16; // Register bit-field
101  } bits; // Register bit-field
102  uint16_t value : 16; // 16-bit wide register value
103  }vFSMINPER; // FSMINPER: FREQUENCY SCALING MINIMUM PERIOD REGISTER
104  union {
105  struct {
106  uint16_t MPHASE : 16; // Register bit-field
107  } bits; // Register bit-field
108  uint16_t value; // 16-bit wide register value
109  }vMPHASE; // MPHASE: MASTER PHASE REGISTER
110  union {
111  struct {
112  uint16_t MDC : 16; // Register bit-field
113  } bits; // Register bit-field
114  uint16_t value; // 16-bit wide register value
115  }vMDC; // MDC: MASTER DUTY CYCLE REGISTER
116  union {
117  struct {
118  uint16_t MPER : 16; // Register bit-field
119  } bits; // Register bit-field
120  uint16_t value; // 16-bit wide register value
121  }vMPER; // MPER: MASTER PERIOD REGISTER
122  union {
123  struct {
124  uint16_t LFSR : 15; // Register bit-field
125  uint16_t : 1; // (reserved)
126  } bits; // Register bit-field
127  uint16_t value; // 16-bit wide register value
128  }vLFSR; // LFSR: LINEAR FEEDBACK SHIFT REGISTER
129  union {
130  struct tagCMBTRIGLBITS bits; // Register bit-field
131  uint16_t value : 16; // 16-bit wide register value
132  }vCMBTRIGL; // CMBTRIGL: COMBINATIONAL TRIGGER REGISTER LOW
133  union {
134  struct tagCMBTRIGHBITS bits; // Register bit-field
135  uint16_t value : 16; // 16-bit wide register value
136  }vCMBTRIGH; // CMBTRIGL: COMBINATIONAL TRIGGER REGISTER HIGH
137  union {
138  struct tagLOGCONABITS bits; // Register bit-field
139  uint16_t value : 16; // 16-bit wide register value
140  }LOGCON_A; // LOGCONx: COMBINATORIAL PWM LOGIC CONTROL REGISTER x
141  union {
142  struct tagLOGCONABITS bits; // Register bit-field
143  uint16_t value : 16; // 16-bit wide register value
144  }LOGCON_B; // LOGCONx: COMBINATORIAL PWM LOGIC CONTROL REGISTER x
145  union {
146  struct tagLOGCONABITS bits; // Register bit-field
147  uint16_t value : 16; // 16-bit wide register value
148  }LOGCON_C; // LOGCONx: COMBINATORIAL PWM LOGIC CONTROL REGISTER x
149  union {
150  struct tagLOGCONABITS bits; // Register bit-field
151  uint16_t value : 16; // 16-bit wide register value
152  }LOGCON_D; // LOGCONx: COMBINATORIAL PWM LOGIC CONTROL REGISTER x
153  union {
154  struct tagLOGCONABITS bits; // Register bit-field
155  uint16_t value : 16; // 16-bit wide register value
156  }LOGCON_E; // LOGCONx: COMBINATORIAL PWM LOGIC CONTROL REGISTER x
157  union {
158  struct tagLOGCONABITS bits; // Register bit-field
159  uint16_t value : 16; // 16-bit wide register value
160  }LOGCON_F; // LOGCONx: COMBINATORIAL PWM LOGIC CONTROL REGISTER x
161  union {
162  struct tagPWMEVTABITS bits; // Register bit-field
163  uint16_t value : 16; // 16-bit wide register value
164  }PWMEVT_A; // PWMEVTx: PWM EVENT OUTPUT CONTROL REGISTER x
165  union {
166  struct tagPWMEVTABITS bits; // Register bit-field
167  uint16_t value : 16; // 16-bit wide register value
168  }PWMEVT_B; // PWMEVTx: PWM EVENT OUTPUT CONTROL REGISTER x
169  union {
170  struct tagPWMEVTABITS bits; // Register bit-field
171  uint16_t value : 16; // 16-bit wide register value
172  }PWMEVT_C; // PWMEVTx: PWM EVENT OUTPUT CONTROL REGISTER x
173  union {
174  struct tagPWMEVTABITS bits; // Register bit-field
175  uint16_t value : 16; // 16-bit wide register value
176  }PWMEVT_D; // PWMEVTx: PWM EVENT OUTPUT CONTROL REGISTER x
177  union {
178  struct tagPWMEVTABITS bits; // Register bit-field
179  uint16_t value : 16; // 16-bit wide register value
180  }PWMEVT_E; // PWMEVTx: PWM EVENT OUTPUT CONTROL REGISTER x
181  union {
182  struct tagPWMEVTABITS bits; // Register bit-field
183  uint16_t value : 16; // 16-bit wide register value
184  }PWMEVT_F; // PWMEVTx: PWM EVENT OUTPUT CONTROL REGISTER x
185 
186  } __attribute__((packed)) P33C_PWM_MODULE_t; // PWM MODULE SPECIAL FUNCTION REGISTER SET
187 
188 #endif
189 
190 
191 // GENERIC PWM GENERATOR SPECIAL FUNCTION REGISTER SET
192 
193 #ifndef P33C_PWM_GENERATOR_s
194 
195  typedef struct P33C_PWM_GENERATOR_s {
196  union {
197  struct tagPG1CONLBITS bits; // Register bit-field
198  uint16_t value : 16; // 16-bit wide register value
199  }PGxCONL; // PGxCONH: PWM GENERATOR x CONTROL REGISTER HIGH
200  union {
201  struct tagPG1CONHBITS bits; // Register bit-field
202  uint16_t value; // 16-bit wide register value
203  }PGxCONH; // PGxCONH: PWM GENERATOR x CONTROL REGISTER HIGH
204  union {
205  struct tagPG1STATBITS bits; // Register bit-field
206  uint16_t value; // 16-bit wide register value
207  }PGxSTAT; // PGxSTAT: PWM GENERATOR x STATUS REGISTER
208  union {
209  struct tagPG1IOCONLBITS bits; // Register bit-field
210  uint16_t value; // 16-bit wide register value
211  }PGxIOCONL; // PGxIOCONL: PWM GENERATOR x I/O CONTROL REGISTER LOW
212  union {
213  struct tagPG1IOCONHBITS bits; // Register bit-field
214  uint16_t value; // 16-bit wide register value
215  } PGxIOCONH; // PGxIOCONH: PWM GENERATOR x I/O CONTROL REGISTER HIGH
216  union {
217  struct tagPG1EVTLBITS bits; // Register bit-field
218  uint16_t value; // 16-bit wide register value
219  }PGxEVTL; // PGxEVTL: PWM GENERATOR x EVENT REGISTER LOW
220  union {
221  struct tagPG1EVTHBITS bits; // Register bit-field
222  uint16_t value; // 16-bit wide register value
223  }PGxEVTH; // PGxEVTH: PWM GENERATOR x EVENT REGISTER HIGH
224  union {
225  struct tagPG1FPCILBITS bits; // Register bit-field
226  uint16_t value; // 16-bit wide register value
227  }PGxFPCIL; // PGxFPCIL: PWM GENERATOR x FAULT PCI REGISTER LOW
228  union {
229  struct tagPG1FPCIHBITS bits; // Register bit-field
230  uint16_t value; // 16-bit wide register value
231  }PGxFPCIH; // PGxFPCIH: PWM GENERATOR x FAULT PCI REGISTER HIGH
232  union {
233  struct tagPG1CLPCILBITS bits; // Register bit-field
234  uint16_t value; // 16-bit wide register value
235  }PGxCLPCIL; // PGxCLPCIL: PWM GENERATOR x CURRENT LIMIT PCI REGISTER LOW
236  union {
237  struct tagPG1CLPCIHBITS bits; // Register bit-field
238  uint16_t value; // 16-bit wide register value
239  }PGxCLPCIH; // PGxCLPCIH: PWM GENERATOR x CURRENT LIMIT PCI REGISTER HIGH
240  union {
241  struct tagPG1FFPCILBITS bits; // Register bit-field
242  uint16_t value; // 16-bit wide register value
243  }PGxFFPCIL; // PGxFFPCIL: PWM GENERATOR x FEED FORWARD PCI REGISTER LOW
244  union {
245  struct tagPG1FFPCIHBITS bits; // Register bit-field
246  uint16_t value; // 16-bit wide register value
247  }PGxFFPCIH; // PGxFFPCIH: PWM GENERATOR x FEED FORWARD PCI REGISTER HIGH
248  union {
249  struct tagPG1SPCILBITS bits; // Register bit-field
250  uint16_t value; // 16-bit wide register value
251  }PGxSPCIL; // PGxSPCIL: PWM GENERATOR x SOFTWARE PCI REGISTER LOW
252  union {
253  struct tagPG1SPCIHBITS bits; // Register bit-field
254  uint16_t value; // 16-bit wide register value
255  }PGxSPCIH; // PGxSPCIH: PWM GENERATOR x SOFTWARE PCI REGISTER HIGH
256  union {
257  struct {
258  uint16_t LEBL : 16; // Register bit-field
259  } bits; // Register bit-field
260  uint16_t value; // 16-bit wide register value
261  }PGxLEBL; // PGxLEBL: PWM GENERATOR x LEADING-EDGE BLANKING REGISTER LOW
262  union {
263  struct tagPG1LEBHBITS bits; // Register bit-field
264  uint16_t value; // 16-bit wide register value
265  }PGxLEBH; // PGxLEBH: PWM GENERATOR x LEADING-EDGE BLANKING REGISTER HIGH
266  union {
267  struct {
268  uint16_t PHASE : 16; // Register bit-field
269  } bits; // Register bit-field
270  uint16_t value; // 16-bit wide register value
271  }PGxPHASE; // PGxPHASE: PWM GENERATOR x PHASE REGISTER
272  union {
273  struct {
274  uint16_t DC : 16; // Register bit-field
275  } bits; // Register bit-field
276  uint16_t value; // 16-bit wide register value
277  }PGxDC; // PGxDC: PWM GENERATOR x DUTY CYCLE REGISTER
278  union {
279  struct tagPG1DCABITS bits; // Register bit-field
280  uint16_t value; // 16-bit wide register value
281  }PGxDCA; // PGxDCA: PWM GENERATOR x DUTY CYCLE ADJUSTMENT REGISTER
282  union {
283  struct {
284  uint16_t PER : 16; // Register bit-field
285  } bits; // Register bit-field
286  uint16_t value; // 16-bit wide register value
287  }PGxPER; // PGxPER: PWM GENERATOR x PERIOD REGISTER
288  union {
289  struct {
290  uint16_t TRIG : 16; // Register bit-field
291  } bits; // Register bit-field
292  uint16_t value; // 16-bit wide register value
293  }PGxTRIGA; // PGxTRIGA: PWM GENERATOR x TRIGGER A REGISTER
294  union {
295  struct {
296  uint16_t TRIG : 16; // Register bit-field
297  } bits; // Register bit-field
298  uint16_t value; // 16-bit wide register value
299  }PGxTRIGB; // PGxTRIGB: PWM GENERATOR x TRIGGER B REGISTER
300  union {
301  struct {
302  uint16_t TRIG : 16; // Register bit-field
303  } bits; // Register bit-field
304  uint16_t value; // 16-bit wide register value
305  }PGxTRIGC; // PGxTRIGC: PWM GENERATOR x TRIGGER C REGISTER
306  union {
307  struct tagPG1DTLBITS bits; // Register bit-field
308  uint16_t value; // 16-bit wide register value
309  }PGxDTL; // PGxDTL: PWM GENERATOR x DEAD-TIME REGISTER LOW
310  union {
311  struct tagPG1DTHBITS bits; // Register bit-field
312  uint16_t value; // 16-bit wide register value
313  }PGxDTH; // PGxDTH: PWM GENERATOR x DEAD-TIME REGISTER HIGH
314  union {
315  struct {
316  uint16_t CAP : 16; // Register bit-field
317  } bits; // Register bit-field
318  uint16_t value : 16; // 16-bit wide register value
319  }PGxCAP; // PGxCAP: PWM GENERATOR x CAPTURE REGISTER
320  } __attribute__((packed)) P33C_PWM_GENERATOR_t; // PWM GENERATOR INSTANCE SPECIAL FUNCTION REGISTER SET
321 
322  // PWM generator instance Special Function Register set address offset
323  #define P33C_PWMGEN_SFR_OFFSET ((volatile uint16_t)&PG2CONL - (volatile uint16_t)&PG1CONL)
324 
325 #endif
326 
327 // Determine number of available PWM generators on the selected device
328 #if defined (PG8CONL)
329  #define P33C_PG_COUNT 8
330 #elif defined (PG4CONL)
331  #define P33C_PG_COUNT 4
332 #endif
333 
334 /* ********************************************************************************************* *
335  * API FUNCTION PROTOTYPES
336  * ********************************************************************************************* */
337 
338 /* ********************************************************************************************* *
339  * Basic PWM Module Configuration Function Call Prototypes
340  * ********************************************************************************************* */
341 
342 // PWM Module essential functions
343 extern volatile struct P33C_PWM_MODULE_s* p33c_PwmModule_GetHandle(void);
344 
345 extern volatile struct P33C_PWM_MODULE_s p33c_PwmModule_ConfigRead(void);
346 extern volatile uint16_t p33c_PwmModule_ConfigWrite(volatile struct P33C_PWM_MODULE_s pwmConfig);
347 
348 // PWM Module higher functions
349 extern volatile uint16_t p33c_PwmModule_Initialize(void);
350 extern volatile uint16_t p33c_PwmModule_Dispose(void);
351 
352 /* ********************************************************************************************* *
353  * Individual PWM Generator Configuration Function Call Prototypes
354  * ********************************************************************************************* */
355 
356 // PWM Generator essential functions
357 extern volatile struct P33C_PWM_GENERATOR_s p33c_PwmGenerator_ConfigRead(volatile uint16_t pgInstance);
358 extern volatile uint16_t p33c_PwmGenerator_ConfigWrite(volatile uint16_t pgInstance,
359  volatile struct P33C_PWM_GENERATOR_s pgConfig);
360 
361 extern volatile struct P33C_PWM_GENERATOR_s* p33c_PwmGenerator_GetHandle(volatile uint16_t pgInstance);
362 extern volatile uint16_t p33c_PwmGenerator_GetInstance(volatile struct P33C_PWM_GENERATOR_s* pg);
363 extern volatile uint16_t p33c_PwmGenerator_GetGroup(volatile struct P33C_PWM_GENERATOR_s* pg);
364 
365 
366 // PWM Generator higher functions
367 extern volatile uint16_t p33c_PwmGenerator_Initialize(volatile uint16_t pgInstance);
368 extern volatile uint16_t p33c_PwmGenerator_Dispose(volatile uint16_t pgInstance);
369 
370 extern volatile uint16_t p33c_PwmGenerator_Enable(volatile struct P33C_PWM_GENERATOR_s* pg);
371 extern volatile uint16_t p33c_PwmGenerator_Disable(volatile struct P33C_PWM_GENERATOR_s* pg);
372 extern volatile uint16_t p33c_PwmGenerator_Resume(volatile struct P33C_PWM_GENERATOR_s* pg);
373 extern volatile uint16_t p33c_PwmGenerator_Suspend(volatile struct P33C_PWM_GENERATOR_s* pg);
374 
375 // Standard Generator Functions API
376 extern volatile uint16_t p33c_PwmGenerator_SetPeriod(volatile struct P33C_PWM_GENERATOR_s* pg,
377  volatile uint16_t period);
378 extern volatile uint16_t p33c_PwmGenerator_SetDutyCycle(volatile struct P33C_PWM_GENERATOR_s* pg,
379  volatile uint16_t duty);
380 extern volatile uint16_t p33c_PwmGenerator_SetDeadTimes(volatile struct P33C_PWM_GENERATOR_s* pg,
381  volatile uint16_t dead_time_rising, volatile uint16_t dead_time_falling);
382 
384  volatile struct P33C_PWM_GENERATOR_s* pgHandleMother,
385  volatile uint16_t pgMotherTriggerOutput,
386  volatile struct P33C_PWM_GENERATOR_s* pgHandleChild,
387  volatile bool ChildImmediateUpdate
388  );
389 
390 /* ********************************************************************************************* *
391  * PWM GENERATOR CONFIGURATION TEMPLATES
392  * ********************************************************************************************* */
393 extern volatile struct P33C_PWM_MODULE_s pwmConfigClear;
394 extern volatile struct P33C_PWM_MODULE_s pwmConfigDefault;
395 
396 /* ********************************************************************************************* *
397  * PWM GENERATOR CONFIGURATION TEMPLATES
398  * ********************************************************************************************* */
399 extern volatile struct P33C_PWM_GENERATOR_s pgConfigClear;
400 
401 
402 #endif /* P33C_PWM_SFR_ABSTRACTION_H */
403 // END OF FILE
P33C_PWM_MODULE_s::LOGCON_A
union P33C_PWM_MODULE_s::@9 LOGCON_A
P33C_PWM_GENERATOR_s::bits
struct tagPG1CONLBITS bits
Definition: p33c_pwm.h:197
p33c_PwmGenerator_SetPeriod
volatile uint16_t p33c_PwmGenerator_SetPeriod(volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t period)
Sets the period of a given PWM generator.
Definition: p33c_pwm.c:457
pgConfigClear
volatile struct P33C_PWM_GENERATOR_s pgConfigClear
Default RESET configuration of one PWM generator instance SFRs.
Definition: p33c_pwm.c:856
P33C_PWM_GENERATOR_s::PGxLEBH
union P33C_PWM_GENERATOR_s::@70 PGxLEBH
P33C_PWM_MODULE_s::PWMEVT_D
union P33C_PWM_MODULE_s::@18 PWMEVT_D
P33C_PWM_GENERATOR_s::PGxIOCONH
union P33C_PWM_GENERATOR_s::@58 PGxIOCONH
P33C_PWM_GENERATOR_s::PGxPHASE
union P33C_PWM_GENERATOR_s::@71 PGxPHASE
P33C_PWM_GENERATOR_s::CAP
uint16_t CAP
Definition: p33c_pwm.h:316
P33C_PWM_MODULE_s::LOGCON_D
union P33C_PWM_MODULE_s::@12 LOGCON_D
P33C_PWM_GENERATOR_s::PGxSTAT
union P33C_PWM_GENERATOR_s::@56 PGxSTAT
P33C_PWM_MODULE_s::vCMBTRIGH
union P33C_PWM_MODULE_s::@8 vCMBTRIGH
p33c_PwmGenerator_Disable
volatile uint16_t p33c_PwmGenerator_Disable(volatile struct P33C_PWM_GENERATOR_s *pg)
Disables a given PWM generator.
Definition: p33c_pwm.c:366
p33c_PwmGenerator_ConfigWrite
volatile uint16_t p33c_PwmGenerator_ConfigWrite(volatile uint16_t pgInstance, volatile struct P33C_PWM_GENERATOR_s pgConfig)
Disposes a given PWM generator by resetting all its registers to default.
Definition: p33c_pwm.c:217
P33C_PWM_MODULE_s::vMDC
union P33C_PWM_MODULE_s::@4 vMDC
pwmConfigClear
volatile struct P33C_PWM_MODULE_s pwmConfigClear
Default RESET configuration of the PWM module SFRs.
Definition: p33c_pwm.c:773
p33c_PwmModule_ConfigWrite
volatile uint16_t p33c_PwmModule_ConfigWrite(volatile struct P33C_PWM_MODULE_s pwmConfig)
Writes a user-defined configuration to the PWM base module registers.
Definition: p33c_pwm.c:158
P33C_PWM_MODULE_s::vPCLKCON
union P33C_PWM_MODULE_s::@0 vPCLKCON
P33C_PWM_GENERATOR_s::PGxDTL
union P33C_PWM_GENERATOR_s::@78 PGxDTL
p33c_PwmGenerator_SyncGenerators
volatile uint16_t p33c_PwmGenerator_SyncGenerators(volatile struct P33C_PWM_GENERATOR_s *pgHandleMother, volatile uint16_t pgMotherTriggerOutput, volatile struct P33C_PWM_GENERATOR_s *pgHandleChild, volatile bool ChildImmediateUpdate)
Sets the synchronization triggers of two PWM generators, of which the Mother PWM generator is the tri...
Definition: p33c_pwm.c:670
P33C_PWM_GENERATOR_s::PGxSPCIL
union P33C_PWM_GENERATOR_s::@67 PGxSPCIL
P33C_PWM_MODULE_s::FSCL
uint16_t FSCL
Definition: p33c_pwm.h:94
p33c_PwmModule_GetHandle
volatile struct P33C_PWM_MODULE_s * p33c_PwmModule_GetHandle(void)
Gets pointer to PWM module SFR set.
Definition: p33c_pwm.c:74
P33C_PWM_MODULE_s::MDC
uint16_t MDC
Definition: p33c_pwm.h:112
P33C_PWM_GENERATOR_s::PGxFFPCIH
union P33C_PWM_GENERATOR_s::@66 PGxFFPCIH
P33C_PWM_GENERATOR_s
Definition: p33c_pwm.h:195
P33C_PWM_MODULE_s::vFSMINPER
union P33C_PWM_MODULE_s::@2 vFSMINPER
p33c_PwmGenerator_GetGroup
volatile uint16_t p33c_PwmGenerator_GetGroup(volatile struct P33C_PWM_GENERATOR_s *pg)
Get the PWM generator group.
Definition: p33c_pwm.c:612
p33c_PwmGenerator_GetHandle
volatile struct P33C_PWM_GENERATOR_s * p33c_PwmGenerator_GetHandle(volatile uint16_t pgInstance)
Returns the PWM generator index.
Definition: p33c_pwm.c:555
P33C_PWM_GENERATOR_s::PGxLEBL
union P33C_PWM_GENERATOR_s::@69 PGxLEBL
P33C_PWM_MODULE_s::PWMEVT_F
union P33C_PWM_MODULE_s::@20 PWMEVT_F
p33c_PwmModule_Dispose
volatile uint16_t p33c_PwmModule_Dispose(void)
Resets all PWM base module registers to their RESET default values.
Definition: p33c_pwm.c:104
p33c_PwmGenerator_Suspend
volatile uint16_t p33c_PwmGenerator_Suspend(volatile struct P33C_PWM_GENERATOR_s *pg)
Disables the PWM generator outputs but keeps the module running.
Definition: p33c_pwm.c:428
P33C_PWM_MODULE_s::PWMEVT_B
union P33C_PWM_MODULE_s::@16 PWMEVT_B
p33c_PwmGenerator_SetDeadTimes
volatile uint16_t p33c_PwmGenerator_SetDeadTimes(volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t dead_time_rising, volatile uint16_t dead_time_falling)
Sets the dead-times of a given PWM generator.
Definition: p33c_pwm.c:524
P33C_PWM_MODULE_s
Definition: p33c_pwm.h:86
P33C_PWM_GENERATOR_s::value
uint16_t value
Definition: p33c_pwm.h:198
P33C_PWM_MODULE_s::value
uint16_t value
Definition: p33c_pwm.h:90
P33C_PWM_MODULE_s::FSMINPER
uint16_t FSMINPER
Definition: p33c_pwm.h:100
P33C_PWM_GENERATOR_s::PHASE
uint16_t PHASE
Definition: p33c_pwm.h:268
P33C_PWM_GENERATOR_s::PGxEVTH
union P33C_PWM_GENERATOR_s::@60 PGxEVTH
P33C_PWM_GENERATOR_s::DC
uint16_t DC
Definition: p33c_pwm.h:274
P33C_PWM_MODULE_s::PWMEVT_C
union P33C_PWM_MODULE_s::@17 PWMEVT_C
P33C_PWM_MODULE_s::LOGCON_B
union P33C_PWM_MODULE_s::@10 LOGCON_B
p33c_PwmGenerator_GetInstance
volatile uint16_t p33c_PwmGenerator_GetInstance(volatile struct P33C_PWM_GENERATOR_s *pg)
Get the PWM generator instance index of a known PWM object pointer address.
Definition: p33c_pwm.c:580
pwmConfigDefault
volatile struct P33C_PWM_MODULE_s pwmConfigDefault
Default initialization configuration of the PWM module SFRs.
Definition: p33c_pwm.c:813
P33C_PWM_GENERATOR_s::PGxDTH
union P33C_PWM_GENERATOR_s::@79 PGxDTH
p33c_PwmModule_Initialize
volatile uint16_t p33c_PwmModule_Initialize(void)
Initializes the PWM base module by resetting all its registers to default.
Definition: p33c_pwm.c:50
P33C_PWM_MODULE_s::MPER
uint16_t MPER
Definition: p33c_pwm.h:118
p33c_PwmGenerator_Resume
volatile uint16_t p33c_PwmGenerator_Resume(volatile struct P33C_PWM_GENERATOR_s *pg)
Disables a PWM generator IOs.
Definition: p33c_pwm.c:400
P33C_PWM_MODULE_s::LOGCON_F
union P33C_PWM_MODULE_s::@14 LOGCON_F
P33C_PWM_GENERATOR_s::PGxCLPCIH
union P33C_PWM_GENERATOR_s::@64 PGxCLPCIH
P33C_PWM_GENERATOR_s::PGxCONH
union P33C_PWM_GENERATOR_s::@55 PGxCONH
p33c_PwmGenerator_SetDutyCycle
volatile uint16_t p33c_PwmGenerator_SetDutyCycle(volatile struct P33C_PWM_GENERATOR_s *pg, volatile uint16_t duty)
Sets the on-time of a given PWM generator.
Definition: p33c_pwm.c:490
P33C_PWM_GENERATOR_s::PGxFPCIH
union P33C_PWM_GENERATOR_s::@62 PGxFPCIH
p33c_PwmGenerator_Dispose
volatile uint16_t p33c_PwmGenerator_Dispose(volatile uint16_t pgInstance)
Disposes a given PWM generator by resetting all its registers to default.
Definition: p33c_pwm.c:290
P33C_PWM_MODULE_s::vMPHASE
union P33C_PWM_MODULE_s::@3 vMPHASE
P33C_PWM_GENERATOR_s::PGxFPCIL
union P33C_PWM_GENERATOR_s::@61 PGxFPCIL
P33C_PWM_MODULE_s::LFSR
uint16_t LFSR
Definition: p33c_pwm.h:124
p33c_PwmModule_ConfigRead
volatile struct P33C_PWM_MODULE_s p33c_PwmModule_ConfigRead(void)
Read the current configuration from the PWM base module registers.
Definition: p33c_pwm.c:127
P33C_PWM_MODULE_s::vLFSR
union P33C_PWM_MODULE_s::@6 vLFSR
P33C_PWM_GENERATOR_s::PER
uint16_t PER
Definition: p33c_pwm.h:284
P33C_PWM_GENERATOR_s::PGxPER
union P33C_PWM_GENERATOR_s::@74 PGxPER
P33C_PWM_MODULE_s::LOGCON_E
union P33C_PWM_MODULE_s::@13 LOGCON_E
P33C_PWM_MODULE_s::PWMEVT_A
union P33C_PWM_MODULE_s::@15 PWMEVT_A
P33C_PWM_MODULE_s::vCMBTRIGL
union P33C_PWM_MODULE_s::@7 vCMBTRIGL
P33C_PWM_GENERATOR_s::PGxFFPCIL
union P33C_PWM_GENERATOR_s::@65 PGxFFPCIL
P33C_PWM_GENERATOR_s::PGxTRIGA
union P33C_PWM_GENERATOR_s::@75 PGxTRIGA
P33C_PWM_GENERATOR_s::PGxEVTL
union P33C_PWM_GENERATOR_s::@59 PGxEVTL
P33C_PWM_GENERATOR_s::PGxCONL
union P33C_PWM_GENERATOR_s::@54 PGxCONL
P33C_PWM_MODULE_s::PWMEVT_E
union P33C_PWM_MODULE_s::@19 PWMEVT_E
P33C_PWM_GENERATOR_s::PGxTRIGC
union P33C_PWM_GENERATOR_s::@77 PGxTRIGC
P33C_PWM_GENERATOR_s::PGxTRIGB
union P33C_PWM_GENERATOR_s::@76 PGxTRIGB
P33C_PWM_GENERATOR_s::TRIG
uint16_t TRIG
Definition: p33c_pwm.h:290
p33c_PwmGenerator_ConfigRead
volatile struct P33C_PWM_GENERATOR_s p33c_PwmGenerator_ConfigRead(volatile uint16_t pgInstance)
Disposes a given PWM generator by resetting all its registers to default.
Definition: p33c_pwm.c:188
P33C_PWM_GENERATOR_s::PGxSPCIH
union P33C_PWM_GENERATOR_s::@68 PGxSPCIH
P33C_PWM_MODULE_s::bits
struct tagPCLKCONBITS bits
Definition: p33c_pwm.h:89
P33C_PWM_GENERATOR_s::LEBL
uint16_t LEBL
Definition: p33c_pwm.h:258
P33C_PWM_MODULE_s::LOGCON_C
union P33C_PWM_MODULE_s::@11 LOGCON_C
P33C_PWM_MODULE_s::vFSCL
union P33C_PWM_MODULE_s::@1 vFSCL
P33C_PWM_MODULE_s::MPHASE
uint16_t MPHASE
Definition: p33c_pwm.h:106
P33C_PWM_GENERATOR_s::PGxCLPCIL
union P33C_PWM_GENERATOR_s::@63 PGxCLPCIL
P33C_PWM_GENERATOR_s::PGxIOCONL
union P33C_PWM_GENERATOR_s::@57 PGxIOCONL
P33C_PWM_GENERATOR_s::PGxDCA
union P33C_PWM_GENERATOR_s::@73 PGxDCA
P33C_PWM_GENERATOR_s::PGxDC
union P33C_PWM_GENERATOR_s::@72 PGxDC
p33c_PwmGenerator_Initialize
volatile uint16_t p33c_PwmGenerator_Initialize(volatile uint16_t pgInstance)
Initializes a given PWM generator by resetting all its registers to default.
Definition: p33c_pwm.c:250
p33c_PwmGenerator_Enable
volatile uint16_t p33c_PwmGenerator_Enable(volatile struct P33C_PWM_GENERATOR_s *pg)
Enables a given PWM generator with output pins disabled.
Definition: p33c_pwm.c:316
P33C_PWM_GENERATOR_s::PGxCAP
union P33C_PWM_GENERATOR_s::@80 PGxCAP
P33C_PWM_MODULE_s::vMPER
union P33C_PWM_MODULE_s::@5 vMPER