Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
p33c_pps.h
1 
25 /*@@p33c_pps.h
26  * ************************************************************************************************
27  * Summary:
28  * Generic Peripheral Pin Select (PPS) Driver Module (header file)
29  *
30  * Description:
31  * This additional header file contains defines for all required bit-settings of all related
32  * special function registers of a peripheral module and/or instance.
33  * This file is an additional header file on top of the generic device header file.
34  *
35  * See Also:
36  * p33c_pps.c
37  * ***********************************************************************************************/
38 
39 #ifndef MCAL_P33C_PPS_ABSTRACTION_DRIVER_H
40 #define MCAL_P33C_PPS_ABSTRACTION_DRIVER_H
41 
42 // Device header file
43 #include <xc.h> // include processor files - each processor file is guarded.
44 #include <stdint.h> // include standard integer types header file
45 #include <stdbool.h> // include standard boolean types header file
46 
47 // Default definitions for all de4vices
48 
49 #define PINMAP_LOCK (0U)
50 #define PINMAP_UNLOCK (1U)
51 
52 // Generic declarations for pin numbers for all devices
53 
54 #define PIN_RPI0 (0U)
55 #define PIN_RPI1 (1U)
56 #define PIN_RPI2 (2U)
57 #define PIN_RPI3 (3U)
58 #define PIN_RPI4 (4U)
59 #define PIN_RPI5 (5U)
60 #define PIN_RPI6 (6U)
61 #define PIN_RPI7 (7U)
62 #define PIN_RPI8 (8U)
63 #define PIN_RPI9 (9U)
64 #define PIN_RPI10 (10U)
65 #define PIN_RPI11 (11U)
66 #define PIN_RPI12 (12U)
67 #define PIN_RPI13 (13U)
68 #define PIN_RPI14 (14U)
69 #define PIN_RPI15 (15U)
70 #define PIN_RPI16 (16U)
71 #define PIN_RPI17 (17U)
72 #define PIN_RPI18 (18U)
73 #define PIN_RPI19 (19U)
74 #define PIN_RPI20 (20U)
75 #define PIN_RPI21 (21U)
76 #define PIN_RPI22 (22U)
77 #define PIN_RPI23 (23U)
78 #define PIN_RPI24 (24U)
79 #define PIN_RPI25 (25U)
80 #define PIN_RPI26 (26U)
81 #define PIN_RPI27 (27U)
82 #define PIN_RPI28 (28U)
83 #define PIN_RPI29 (29U)
84 #define PIN_RPI30 (30U)
85 #define PIN_RPI31 (31U)
86 #define PIN_RPI32 (32U)
87 #define PIN_RPI33 (33U)
88 #define PIN_RPI34 (34U)
89 #define PIN_RPI35 (35U)
90 #define PIN_RPI36 (36U)
91 #define PIN_RPI37 (37U)
92 #define PIN_RPI38 (38U)
93 #define PIN_RPI39 (39U)
94 #define PIN_RPI40 (40U)
95 #define PIN_RPI41 (41U)
96 #define PIN_RPI42 (42U)
97 #define PIN_RPI43 (43U)
98 #define PIN_RPI44 (44U)
99 #define PIN_RPI45 (45U)
100 #define PIN_RPI46 (46U)
101 #define PIN_RPI47 (47U)
102 #define PIN_RPI48 (48U)
103 #define PIN_RPI49 (49U)
104 #define PIN_RPI50 (50U)
105 #define PIN_RPI51 (51U)
106 #define PIN_RPI52 (52U)
107 #define PIN_RPI53 (53U)
108 #define PIN_RPI54 (54U)
109 #define PIN_RPI55 (55U)
110 #define PIN_RPI56 (56U)
111 #define PIN_RPI57 (57U)
112 #define PIN_RPI58 (58U)
113 #define PIN_RPI59 (59U)
114 #define PIN_RPI60 (60U)
115 #define PIN_RPI61 (61U)
116 #define PIN_RPI62 (62U)
117 #define PIN_RPI63 (63U)
118 #define PIN_RPI64 (64U)
119 #define PIN_RPI65 (65U)
120 #define PIN_RPI66 (66U)
121 #define PIN_RPI67 (67U)
122 #define PIN_RPI68 (68U)
123 #define PIN_RPI69 (69U)
124 #define PIN_RPI70 (70U)
125 #define PIN_RPI71 (71U)
126 #define PIN_RPI72 (72U)
127 #define PIN_RPI73 (73U)
128 #define PIN_RPI74 (74U)
129 #define PIN_RPI75 (75U)
130 #define PIN_RPI76 (76U)
131 #define PIN_RPI77 (77U)
132 #define PIN_RPI78 (78U)
133 #define PIN_RPI79 (79U)
134 #define PIN_RPI80 (80U)
135 #define PIN_RPI81 (81U)
136 #define PIN_RPI82 (82U)
137 #define PIN_RPI83 (83U)
138 #define PIN_RPI84 (84U)
139 #define PIN_RPI85 (85U)
140 #define PIN_RPI86 (86U)
141 #define PIN_RPI87 (87U)
142 #define PIN_RPI88 (88U)
143 #define PIN_RPI89 (89U)
144 #define PIN_RPI90 (90U)
145 #define PIN_RPI91 (91U)
146 #define PIN_RPI92 (92U)
147 #define PIN_RPI93 (93U)
148 #define PIN_RPI94 (94U)
149 #define PIN_RPI95 (95U)
150 #define PIN_RPI96 (96U)
151 #define PIN_RPI97 (97U)
152 #define PIN_RPI98 (98U)
153 #define PIN_RPI99 (99U)
154 #define PIN_RPI100 (100U)
155 #define PIN_RPI101 (101U)
156 #define PIN_RPI102 (102U)
157 #define PIN_RPI103 (103U)
158 #define PIN_RPI104 (104U)
159 #define PIN_RPI105 (105U)
160 #define PIN_RPI106 (106U)
161 #define PIN_RPI107 (107U)
162 #define PIN_RPI108 (108U)
163 #define PIN_RPI109 (109U)
164 #define PIN_RPI110 (110U)
165 #define PIN_RPI111 (111U)
166 #define PIN_RPI112 (112U)
167 #define PIN_RPI113 (113U)
168 #define PIN_RPI114 (114U)
169 #define PIN_RPI115 (115U)
170 #define PIN_RPI116 (116U)
171 #define PIN_RPI117 (117U)
172 #define PIN_RPI118 (118U)
173 #define PIN_RPI119 (119U)
174 #define PIN_RPI120 (120U)
175 #define PIN_RPI121 (121U)
176 #define PIN_RPI122 (122U)
177 #define PIN_RPI123 (123U)
178 #define PIN_RPI124 (124U)
179 #define PIN_RPI125 (125U)
180 #define PIN_RPI126 (126U)
181 #define PIN_RPI127 (127U)
182 #define PIN_RPI128 (128U)
183 #define PIN_RPI129 (129U)
184 #define PIN_RPI130 (130U)
185 #define PIN_RPI131 (131U)
186 #define PIN_RPI132 (132U)
187 #define PIN_RPI133 (133U)
188 #define PIN_RPI134 (134U)
189 #define PIN_RPI135 (135U)
190 #define PIN_RPI136 (136U)
191 #define PIN_RPI137 (137U)
192 #define PIN_RPI138 (138U)
193 #define PIN_RPI139 (139U)
194 #define PIN_RPI140 (140U)
195 #define PIN_RPI141 (141U)
196 #define PIN_RPI142 (142U)
197 #define PIN_RPI143 (143U)
198 #define PIN_RPI144 (144U)
199 #define PIN_RPI145 (145U)
200 #define PIN_RPI146 (146U)
201 #define PIN_RPI147 (147U)
202 #define PIN_RPI148 (148U)
203 #define PIN_RPI149 (149U)
204 #define PIN_RPI150 (150U)
205 #define PIN_RPI151 (151U)
206 #define PIN_RPI152 (152U)
207 #define PIN_RPI153 (153U)
208 #define PIN_RPI154 (154U)
209 #define PIN_RPI155 (155U)
210 #define PIN_RPI156 (156U)
211 #define PIN_RPI157 (157U)
212 #define PIN_RPI158 (158U)
213 #define PIN_RPI159 (159U)
214 #define PIN_RPI160 (160U)
215 #define PIN_RPI161 (161U)
216 #define PIN_RPI162 (162U)
217 #define PIN_RPI163 (163U)
218 #define PIN_RPI164 (164U)
219 #define PIN_RPI165 (165U)
220 #define PIN_RPI166 (166U)
221 #define PIN_RPI167 (167U)
222 #define PIN_RPI168 (168U)
223 #define PIN_RPI169 (169U)
224 #define PIN_RPI170 (170U)
225 #define PIN_RPI171 (171U)
226 #define PIN_RPI172 (172U)
227 #define PIN_RPI173 (173U)
228 #define PIN_RPI174 (174U)
229 #define PIN_RPI175 (175U)
230 #define PIN_RPI176 (176U)
231 #define PIN_RPI177 (177U)
232 #define PIN_RPI178 (178U)
233 #define PIN_RPI179 (179U)
234 #define PIN_RPI180 (180U)
235 #define PIN_RPI181 (181U)
236 #define PIN_RPI182 (182U)
237 #define PIN_RPI183 (183U)
238 #define PIN_RPI184 (184U)
239 #define PIN_RPI185 (185U)
240 #define PIN_RPI186 (186U)
241 #define PIN_RPI187 (187U)
242 #define PIN_RPI188 (188U)
243 #define PIN_RPI189 (189U)
244 #define PIN_RPI190 (190U)
245 #define PIN_RPI191 (191U)
246 #define PIN_RPI192 (192U)
247 #define PIN_RPI193 (193U)
248 #define PIN_RPI194 (194U)
249 #define PIN_RPI195 (195U)
250 #define PIN_RPI196 (196U)
251 #define PIN_RPI197 (197U)
252 #define PIN_RPI198 (198U)
253 #define PIN_RPI199 (199U)
254 #define PIN_RPI200 (200U)
255 #define PIN_RPI201 (201U)
256 #define PIN_RPI202 (202U)
257 #define PIN_RPI203 (203U)
258 #define PIN_RPI204 (204U)
259 #define PIN_RPI205 (205U)
260 #define PIN_RPI206 (206U)
261 #define PIN_RPI207 (207U)
262 #define PIN_RPI208 (208U)
263 #define PIN_RPI209 (209U)
264 #define PIN_RPI210 (210U)
265 #define PIN_RPI211 (211U)
266 #define PIN_RPI212 (212U)
267 #define PIN_RPI213 (213U)
268 #define PIN_RPI214 (214U)
269 #define PIN_RPI215 (215U)
270 #define PIN_RPI216 (216U)
271 #define PIN_RPI217 (217U)
272 #define PIN_RPI218 (218U)
273 #define PIN_RPI219 (219U)
274 #define PIN_RPI220 (220U)
275 #define PIN_RPI221 (221U)
276 #define PIN_RPI222 (222U)
277 #define PIN_RPI223 (223U)
278 #define PIN_RPI224 (224U)
279 #define PIN_RPI225 (225U)
280 #define PIN_RPI226 (226U)
281 #define PIN_RPI227 (227U)
282 #define PIN_RPI228 (228U)
283 #define PIN_RPI229 (229U)
284 #define PIN_RPI230 (230U)
285 #define PIN_RPI231 (231U)
286 #define PIN_RPI232 (232U)
287 #define PIN_RPI233 (233U)
288 #define PIN_RPI234 (234U)
289 #define PIN_RPI235 (235U)
290 #define PIN_RPI236 (236U)
291 #define PIN_RPI237 (237U)
292 #define PIN_RPI238 (238U)
293 #define PIN_RPI239 (239U)
294 #define PIN_RPI240 (240U)
295 #define PIN_RPI241 (241U)
296 #define PIN_RPI242 (242U)
297 #define PIN_RPI243 (243U)
298 #define PIN_RPI244 (244U)
299 #define PIN_RPI245 (245U)
300 #define PIN_RPI246 (246U)
301 #define PIN_RPI247 (247U)
302 #define PIN_RPI248 (248U)
303 #define PIN_RPI249 (249U)
304 #define PIN_RPI250 (250U)
305 #define PIN_RPI251 (251U)
306 #define PIN_RPI252 (252U)
307 #define PIN_RPI253 (253U)
308 #define PIN_RPI254 (254U)
309 #define PIN_RPI255 (255U)
310 
311 // driver definitions for maximum pin number supported
312 #define RP_PINNO_MIN 32
313 #define RP_PINNO_MAX 181
314 
315 #define PPSOUT_DEFAULT 0b0000000 // RPn tied to VSS
316 #define PPSOUT_NULL 0b0000000 // RPn tied to VSS
317 #define PPSOUT_NONE 0b0000000 // RPn tied to VSS
318 #define PPSPIN_NULL (0U)
319 
320 /* ---------------------------------------------------------------------------
321  * Enumeration for remappable input pins (values for register RPINRx)
322  * ---------------------------------------------------------------------------*/
323 
324 #define PPSI_RB0 (32U)
325 #define PPSI_RB1 (33U)
326 #define PPSI_RB2 (34U)
327 #define PPSI_RB3 (35U)
328 #define PPSI_RB4 (36U)
329 #define PPSI_RB5 (37U)
330 #define PPSI_RB6 (38U)
331 #define PPSI_RB7 (39U)
332 #define PPSI_RB8 (40U)
333 #define PPSI_RB9 (41U)
334 #define PPSI_RB10 (42U)
335 #define PPSI_RB11 (43U)
336 #define PPSI_RB12 (44U)
337 #define PPSI_RB13 (45U)
338 #define PPSI_RB14 (46U)
339 #define PPSI_RB15 (47U)
340 
341 #define PPSI_RC0 (48U)
342 #define PPSI_RC1 (49U)
343 #define PPSI_RC2 (50U)
344 #define PPSI_RC3 (51U)
345 #define PPSI_RC4 (52U)
346 #define PPSI_RC5 (53U)
347 #define PPSI_RC6 (54U)
348 #define PPSI_RC7 (55U)
349 #define PPSI_RC8 (56U)
350 #define PPSI_RC9 (57U)
351 #define PPSI_RC10 (58U)
352 #define PPSI_RC11 (59U)
353 #define PPSI_RC12 (60U)
354 #define PPSI_RC13 (61U)
355 #define PPSI_RC14 (62U)
356 #define PPSI_RC15 (63U)
357 
358 #define PPSI_RD0 (64U)
359 #define PPSI_RD1 (65U)
360 #define PPSI_RD2 (66U)
361 #define PPSI_RD3 (67U)
362 #define PPSI_RD4 (68U)
363 #define PPSI_RD5 (69U)
364 #define PPSI_RD6 (70U)
365 #define PPSI_RD7 (71U)
366 
367 /* ---------------------------------------------------------------------------
368  * // Enumeration for remappable output pins (offset to register RPOR0)
369  * ---------------------------------------------------------------------------*/
370 
371 #define PPSO_RB0 (5U)
372 #define PPSO_RB1 (6U)
373 #define PPSO_RB2 (7U)
374 #define PPSO_RB3 (8U)
375 #define PPSO_RB4 (9U)
376 #define PPSO_RB5 (10U)
377 #define PPSO_RB6 (11U)
378 #define PPSO_RB7 (12U)
379 #define PPSO_RB8 (13U)
380 #define PPSO_RB9 (14U)
381 #define PPSO_RB10 (15U)
382 #define PPSO_RB11 (16U)
383 #define PPSO_RB12 (17U)
384 #define PPSO_RB13 (18U)
385 #define PPSO_RB14 (19U)
386 #define PPSO_RB15 (20U)
387 
388 #define PPSO_RC0 (21U)
389 #define PPSO_RC1 (22U)
390 #define PPSO_RC2 (23U)
391 #define PPSO_RC3 (24U)
392 #define PPSO_RC4 (25U)
393 #define PPSO_RC5 (26U)
394 #define PPSO_RC6 (27U)
395 #define PPSO_RC7 (28U)
396 #define PPSO_RC8 (29U)
397 #define PPSO_RC9 (30U)
398 #define PPSO_RC10 (31U)
399 #define PPSO_RC11 (32U)
400 #define PPSO_RC12 (33U)
401 #define PPSO_RC13 (34U)
402 #define PPSO_RC14 (35U)
403 #define PPSO_RC15 (36U)
404 
405 #define PPSO_RD0 (37U)
406 #define PPSO_RD1 (38U)
407 #define PPSO_RD2 (39U)
408 #define PPSO_RD3 (40U)
409 #define PPSO_RD4 (41U)
410 #define PPSO_RD5 (42U)
411 #define PPSO_RD6 (43U)
412 #define PPSO_RD7 (44U)
413 
414 /* ---------------------------------------------------------------------------
415  * Defines for register direct addressing of available remappable output pins
416  * ---------------------------------------------------------------------------*/
417 
418 #define PPS_RPO32 (uint8_t*)&RPOR0
419 #define PPS_RPO33 (uint8_t*)&RPOR0+1
420 #define PPS_RPO34 (uint8_t*)&RPOR1
421 #define PPS_RPO35 (uint8_t*)&RPOR1+1
422 #define PPS_RPO36 (uint8_t*)&RPOR2
423 #define PPS_RPO37 (uint8_t*)&RPOR2+1
424 #define PPS_RPO38 (uint8_t*)&RPOR3
425 #define PPS_RPO39 (uint8_t*)&RPOR3+1
426 #define PPS_RPO40 (uint8_t*)&RPOR4
427 #define PPS_RPO41 (uint8_t*)&RPOR4+1
428 #define PPS_RPO42 (uint8_t*)&RPOR5
429 #define PPS_RPO43 (uint8_t*)&RPOR5+1
430 #define PPS_RPO44 (uint8_t*)&RPOR6
431 #define PPS_RPO45 (uint8_t*)&RPOR6+1
432 #define PPS_RPO46 (uint8_t*)&RPOR7
433 #define PPS_RPO47 (uint8_t*)&RPOR7+1
434 #define PPS_RPO48 (uint8_t*)&RPOR8
435 #define PPS_RPO49 (uint8_t*)&RPOR8+1
436 #define PPS_RPO50 (uint8_t*)&RPOR9
437 #define PPS_RPO51 (uint8_t*)&RPOR9+1
438 #define PPS_RPO52 (uint8_t*)&RPOR10
439 #define PPS_RPO53 (uint8_t*)&RPOR10+1
440 #define PPS_RPO54 (uint8_t*)&RPOR11
441 #define PPS_RPO55 (uint8_t*)&RPOR11+1
442 #define PPS_RPO56 (uint8_t*)&RPOR12
443 #define PPS_RPO57 (uint8_t*)&RPOR12+1
444 #define PPS_RPO58 (uint8_t*)&RPOR13
445 #define PPS_RPO59 (uint8_t*)&RPOR13+1
446 #define PPS_RPO60 (uint8_t*)&RPOR14
447 #define PPS_RPO61 (uint8_t*)&RPOR14+1
448 #define PPS_RPO62 (uint8_t*)&RPOR15
449 #define PPS_RPO63 (uint8_t*)&RPOR15+1
450 #define PPS_RPO64 (uint8_t*)&RPOR16
451 #define PPS_RPO65 (uint8_t*)&RPOR16+1
452 #define PPS_RPO66 (uint8_t*)&RPOR17
453 #define PPS_RPO67 (uint8_t*)&RPOR17+1
454 #define PPS_RPO68 (uint8_t*)&RPOR18
455 #define PPS_RPO69 (uint8_t*)&RPOR18+1
456 #define PPS_RPO70 (uint8_t*)&RPOR19
457 #define PPS_RPO71 (uint8_t*)&RPOR19+1
458 #define PPS_RPO72 (uint8_t*)&RPOR20
459 #define PPS_RPO73 (uint8_t*)&RPOR20+1
460 #define PPS_RPO74 (uint8_t*)&RPOR21
461 #define PPS_RPO75 (uint8_t*)&RPOR21+1
462 #define PPS_RPO76 (uint8_t*)&RPOR22
463 #define PPS_RPO78 (uint8_t*)&RPOR22+1
464 #define PPS_RPO79 (uint8_t*)&RPOR23
465 #define PPS_RPO80 (uint8_t*)&RPOR23+1
466 
467 // Virtual pins
468 #define PPS_VITUAL_RPO176 (uint8_t*)&RPOR24
469 #define PPS_VITUAL_RPO177 (uint8_t*)&RPOR24+1
470 #define PPS_VITUAL_RPO178 (uint8_t*)&RPOR25
471 #define PPS_VITUAL_RPO179 (uint8_t*)&RPOR25+1
472 #define PPS_VITUAL_RPO180 (uint8_t*)&RPOR26
473 #define PPS_VITUAL_RPO181 (uint8_t*)&RPOR26+1
474 
475 /* ---------------------------------------------------------------------------
476  * defines for register addresses for available output sources
477  * The pin number 0...181 will be the value written to the registers
478  * declared here
479  *
480  * TABLE: OUTPUT SELECTION FOR REMAPPABLE PINS (RPn)
481  * ---------------------------------------------------------------------------*/
482 
483 #define PPSOUT_VSS (uint8_t)0b000000 // RPn tied to VSS
484 
485 #define PPSOUT_U1TX (uint8_t)0b000001 // RPn tied to UART1 Transmit
486 #define PPSOUT_U1RTS (uint8_t)0b000010 // RPn tied to UART1 Request-to-Send
487 #define PPSOUT_U2TX (uint8_t)0b000011 // RPn tied to UART2 Transmit
488 #define PPSOUT_U2RTS (uint8_t)0b000100 // RPn tied to UART2 Request-to-Send
489 #define PPSOUT_U3TX (uint8_t)0b011011 // RPn tied to UART3 Transmit
490 #define PPSOUT_U3RTS (uint8_t)0b011100 // RPn tied to UART3 Request-to-Send
491 
492 #define PPSOUT_SDO1 (uint8_t)0b000101 // RPn tied to SPI1 Data Output
493 #define PPSOUT_SCK1 (uint8_t)0b000110 // RPn tied to SPI1 Clock Output
494 #define PPSOUT_SS1 (uint8_t)0b000111 // RPn tied to SPI1 Slave Select
495 #define PPSOUT_SDO2 (uint8_t)0b001000 // RPn tied to SPI2 Data Output
496 #define PPSOUT_SCK2 (uint8_t)0b001001 // RPn tied to SPI2 Clock Output
497 #define PPSOUT_SS2 (uint8_t)0b001010 // RPn tied to SPI2 Slave Select
498 #define PPSOUT_SDO3 (uint8_t)0b001011 // RPn tied to SPI3 Data Output
499 #define PPSOUT_SCK3 (uint8_t)0b001100 // RPn tied to SPI3 Clock Output
500 #define PPSOUT_SS3 (uint8_t)0b001101 // RPn tied to SPI3 Slave Select
501 
502 #define PPSOUT_REFCLKO (uint8_t)0b001110 // RPn tied to Reference Clock Output
503 #define PPSOUT_OCM1 (uint8_t)0b001111 // RPn tied to SCCP1 Output
504 #define PPSOUT_OCM2 (uint8_t)0b010000 // RPn tied to SCCP2 Output
505 #define PPSOUT_OCM3 (uint8_t)0b010001 // RPn tied to SCCP3 Output
506 #define PPSOUT_OCM4 (uint8_t)0b010010 // RPn tied to SCCP4 Output
507 #define PPSOUT_OCM5 (uint8_t)0b010011 // RPn tied to SCCP5 Output
508 #define PPSOUT_OCM6 (uint8_t)0b010100 // RPn tied to SCCP6 Output
509 #define PPSOUT_CAN1 (uint8_t)0b010101 // RPn tied to CAN1 Output
510 #define PPSOUT_CMP1 (uint8_t)0b010111 // RPn tied to Comparator 1 Output
511 #define PPSOUT_CMP2 (uint8_t)0b011000 // RPn tied to Comparator 2 Output
512 #define PPSOUT_CMP3 (uint8_t)0b011001 // RPn tied to Comparator 3 Output
513 
514 #define PPSOUT_PWM4H (uint8_t)0b100010 // RPn tied to PWM4H Output
515 #define PPSOUT_PWM4L (uint8_t)0b100011 // RPn tied to PWM4L Output
516 #define PPSOUT_PWMEA (uint8_t)0b100100 // RPn tied to PWM Event A Output
517 #define PPSOUT_PWMEB (uint8_t)0b100101 // RPn tied to PWM Event B Output
518 #define PPSOUT_QEICMP1 (uint8_t)0b100110 // RPn tied to QEI1 Comparator Output
519 #define PPSOUT_QEICMP2 (uint8_t)0b100111 // RPn tied to QEI2 Comparator Output
520 #define PPSOUT_CLC1OUT (uint8_t)0b101000 // RPn tied to CLC1 Output
521 #define PPSOUT_CLC2OUT (uint8_t)0b101001 // RPn tied to CLC2 Output
522 #define PPSOUT_OCM7 (uint8_t)0b101010 // RPn tied to SCCP7 Output
523 #define PPSOUT_OCM8 (uint8_t)0b101011 // RPn tied to SCCP8 Output
524 
525 #define PPSOUT_PWMEC (uint8_t)0b101100 // RPn tied to PWM Event C Output
526 #define PPSOUT_PWMED (uint8_t)0b101101 // RPn tied to PWM Event D Output
527 #define PPSOUT_PTGTRG24 (uint8_t)0b101110 // PTG Trigger Output 24
528 #define PPSOUT_PTGTRG25 (uint8_t)0b101111 // PTG Trigger Output 25
529 #define PPSOUT_SENT1OUT (uint8_t)0b110000 // RPn tied to SENT1 Output
530 #define PPSOUT_SENT2OUT (uint8_t)0b110001 // RPn tied to SENT2 Output
531 #define PPSOUT_MCCP9A (uint8_t)0b110010 // RPn tied to MCCP9 Output A
532 #define PPSOUT_MCCP9B (uint8_t)0b110011 // RPn tied to MCCP9 Output B
533 #define PPSOUT_MCCP9C (uint8_t)0b110100 // RPn tied to MCCP9 Output C
534 #define PPSOUT_MCCP9D (uint8_t)0b110101 // RPn tied to MCCP9 Output D
535 #define PPSOUT_MCCP9E (uint8_t)0b110110 // RPn tied to MCCP9 Output E
536 #define PPSOUT_MCCP9F (uint8_t)0b110111 // RPn tied to MCCP9 Output F
537 #define PPSOUT_CLC3OUT (uint8_t)0b110010 // RPn tied to CLC3 Output
538 #define PPSOUT_CLC4OUT (uint8_t)0b110011 // RPn tied to CLC4 Output
539 
540 #define PPSOUT_U1DTR (uint8_t)0b110100 // Data Terminal Ready Output 1
541 #define PPSOUT_U2DTR (uint8_t)0b110101 // Data Terminal Ready Output 2
542 #define PPSOUT_U3DTR (uint8_t)0b111111 //RPn tied to UART3 DTR
543 
544 /* peripheral ID macros */
545 #if defined (PPSOUT_OCM9)
546 #define PPSOUT_OCM_INSTANCES (uint8_t[9]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3, PPSOUT_OCM4, PPSOUT_OCM5, PPSOUT_OCM6, PPSOUT_OCM7, PPSOUT_OCM8, PPSOUT_OCM9 }
547 #elif defined (PPSOUT_OCM8)
548 #define PPSOUT_OCM_INSTANCES (uint8_t[8]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3, PPSOUT_OCM4, PPSOUT_OCM5, PPSOUT_OCM6, PPSOUT_OCM7, PPSOUT_OCM8 }
549 #elif defined (PPSOUT_OCM7)
550 #define PPSOUT_OCM_INSTANCES (uint8_t[7]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3, PPSOUT_OCM4, PPSOUT_OCM5, PPSOUT_OCM6, PPSOUT_OCM7 }
551 #elif defined (PPSOUT_OCM6)
552 #define PPSOUT_OCM_INSTANCES (uint8_t[6]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3, PPSOUT_OCM4, PPSOUT_OCM5, PPSOUT_OCM6 }
553 #elif defined (PPSOUT_OCM5)
554 #define PPSOUT_OCM_INSTANCES (uint8_t[5]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3, PPSOUT_OCM4, PPSOUT_OCM5 }
555 #elif defined (PPSOUT_OCM4)
556 #define PPSOUT_OCM_INSTANCES (uint8_t[4]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3, PPSOUT_OCM4 }
557 #elif defined (PPSOUT_OCM3)
558 #define PPSOUT_OCM_INSTANCES (uint8_t[3]){ PPSOUT_OCM1, PPSOUT_OCM2, PPSOUT_OCM3 }
559 #elif defined (PPSOUT_OCM2)
560 #define PPSOUT_OCM_INSTANCES (uint8_t[2]){ PPSOUT_OCM1, PPSOUT_OCM2 }
561 #elif defined (PPSOUT_OCM1)
562 #define PPSOUT_OCM_INSTANCES (uint8_t[1]){ PPSOUT_OCM1 }
563 #endif
564 
565 #if defined (PPSOUT_CMP6)
566 #define PPSOUT_CMP_INSTANCES (uint8_t[5]){ PPSOUT_CMP1, PPSOUT_CMP2, PPSOUT_CMP3, PPSOUT_CMP4, PPSOUT_CMP5, PPSOUT_CMP6 }
567 #elif defined (PPSOUT_CMP5)
568 #define PPSOUT_CMP_INSTANCES (uint8_t[5]){ PPSOUT_CMP1, PPSOUT_CMP2, PPSOUT_CMP3, PPSOUT_CMP4, PPSOUT_CMP5 }
569 #elif defined (PPSOUT_CMP4)
570 #define PPSOUT_CMP_INSTANCES (uint8_t[4]){ PPSOUT_CMP1, PPSOUT_CMP2, PPSOUT_CMP3, PPSOUT_CMP4 }
571 #elif defined (PPSOUT_CMP3)
572 #define PPSOUT_CMP_INSTANCES (uint8_t[3]){ PPSOUT_CMP1, PPSOUT_CMP2, PPSOUT_CMP3 }
573 #elif defined (PPSOUT_CMP2)
574 #define PPSOUT_CMP_INSTANCES (uint8_t[2]){ PPSOUT_CMP1, PPSOUT_CMP2 }
575 #elif defined (PPSOUT_CMP1)
576 #define PPSOUT_CMP_INSTANCES (uint8_t[1]){ PPSOUT_CMP1 }
577 #endif
578 
579 
580 // Macro to derive Peripehral Pin Select Output number of Output Compare peripheral instance
581 #define p33c_PPS_GetRPOR_OCM(x) {(uint8_t)PPSOUT_OCM_INSTANCES[x-1]}
582 #define p33c_PPS_GetRPOR_CMP(x) {(uint8_t)PPSOUT_CMP_INSTANCES[x-1]}
583 
584 
585 /* ---------------------------------------------------------------------------
586  * defines for register addresses for available input sources
587  * The pin number 0...181 will be the value written to the registers
588  * declared here
589  *
590  * TABLE: SELECTABLE INPUT SOURCES (MAPS INPUT TO FUNCTION)
591  * ---------------------------------------------------------------------------*/
592 
593 #define PPSIN_INT1 (uint8_t*)&RPINR0+1 // External Interrupt 1
594 #define PPSIN_INT2 (uint8_t*)&RPINR1 // External Interrupt 2
595 #define PPSIN_INT3 (uint8_t*)&RPINR1+1 // External Interrupt 3
596 #define PPSIN_T1CK (uint8_t*)&RPINR2+1 // Timer1 External Clock
597 #define PPSIN_TCKI1 (uint8_t*)&RPINR3 // SCCP Timer1
598 #define PPSIN_ICM1 (uint8_t*)&RPINR3+1 // SCCP Capture 1
599 #define PPSIN_TCKI2 (uint8_t*)&RPINR4 // SCCP Timer2
600 #define PPSIN_ICM2 (uint8_t*)&RPINR4+1 // SCCP Capture 2
601 #define PPSIN_TCKI3 (uint8_t*)&RPINR5 // SCCP Timer3
602 #define PPSIN_ICM3 (uint8_t*)&RPINR5+1 // SCCP Capture 3
603 #define PPSIN_TCKI4 (uint8_t*)&RPINR6 // SCCP Timer4
604 #define PPSIN_ICM4 (uint8_t*)&RPINR6+1 // SCCP Capture 4
605 #define PPSIN_TCKI5 (uint8_t*)&RPINR7 // SCCP Timer5
606 #define PPSIN_ICM5 (uint8_t*)&RPINR7+1 // SCCP Capture 5
607 #define PPSIN_TCKI6 (uint8_t*)&RPINR8 // SCCP Timer6
608 #define PPSIN_ICM6 (uint8_t*)&RPINR8+1 // SCCP Capture 6
609 #define PPSIN_TCKI7 (uint8_t*)&RPINR9 // SCCP Timer7
610 #define PPSIN_ICM7 (uint8_t*)&RPINR9+1 // SCCP Capture 7
611 #define PPSIN_TCKI8 (uint8_t*)&RPINR10 // SCCP Timer8
612 #define PPSIN_ICM8 (uint8_t*)&RPINR10+1 // SCCP Capture 8
613 #define PPSIN_OCFA (uint8_t*)&RPINR11 // xCCP Fault A
614 #define PPSIN_OCFB (uint8_t*)&RPINR11+1 // xCCP Fault B
615 #define PPSIN_PCI8 (uint8_t*)&RPINR12 // PWM PCI 8
616 #define PPSIN_PCI9 (uint8_t*)&RPINR12+1 // PWM PCI 9
617 #define PPSIN_PCI10 (uint8_t*)&RPINR13 // PWM PCI 10
618 #define PPSIN_PCI11 (uint8_t*)&RPINR13+1 // PWM PCI 11
619 #define PPSIN_QEIA1 (uint8_t*)&RPINR14 // QEI1 Input A
620 #define PPSIN_QEIB1 (uint8_t*)&RPINR14+1 // QEI1 Input B
621 #define PPSIN_QEINDX1 (uint8_t*)&RPINR15 // QEI1 Index 1
622 #define PPSIN_QEIHOM1 (uint8_t*)&RPINR15+1 // QEI1 Home 1
623 #define PPSIN_QEIA2 (uint8_t*)&RPINR16 // QEI2 Input A
624 #define PPSIN_QEIB2 (uint8_t*)&RPINR16+1 // QEI2 Input B
625 #define PPSIN_QEINDX2 (uint8_t*)&RPINR17 // QEI2 Index 1
626 #define PPSIN_QEIHOM2 (uint8_t*)&RPINR17+1 // QEI2 Home 1
627 #define PPSIN_U1RX (uint8_t*)&RPINR18 // UART1 Receive
628 #define PPSIN_U1DSR (uint8_t*)&RPINR18+1 // UART1 Data-Set Ready
629 #define PPSIN_U2RX (uint8_t*)&RPINR19 // UART2 Receive
630 #define PPSIN_U2DSR (uint8_t*)&RPINR19+1 // UART2 Data-Set-Ready
631 #define PPSIN_SDI1 (uint8_t*)&RPINR20 // SPI1 Data Input
632 #define PPSIN_SCK1IN (uint8_t*)&RPINR20+1 // SPI1 Clock Input
633 #define PPSIN_SS1 (uint8_t*)&RPINR21 // SPI1 Slave Select
634 #define PPSIN_REFOI (uint8_t*)&RPINR21+1 // Reference Clock Input
635 #define PPSIN_SDI2 (uint8_t*)&RPINR22 // SPI2 Data Input
636 #define PPSIN_SCK2IN (uint8_t*)&RPINR22+1 // SPI2 Clock Input
637 #define PPSIN_SS2 (uint8_t*)&RPINR23 // SPI2 Slave Select
638 #define PPSIN_CAN1RX (uint8_t*)&RPINR26 // CAN1 Input
639 #define PPSIN_U3RX (uint8_t*)&RPINR27 // UART3 Receive
640 #define PPSIN_U3DSR (uint8_t*)&RPINR27+1 // UART3 Data-Set-Ready
641 #define PPSIN_SDI3 (uint8_t*)&RPINR29 // SPI3 Data Input
642 #define PPSIN_SCK3IN (uint8_t*)&RPINR29+1 // SPI3 Clock Input
643 #define PPSIN_SS3 (uint8_t*)&RPINR30 // SPI3 Slave Select
644 #define PPSIN_TCKI9 (uint8_t*)&RPINR32+1 // MCCP Timer9
645 #define PPSIN_ICM9 (uint8_t*)&RPINR33 // MCCP Capture 9
646 #define PPSIN_OCFC (uint8_t*)&RPINR37 // xCCP Fault C
647 #define PPSIN_PCI17 (uint8_t*)&RPINR37+1 // PWM Input 17
648 #define PPSIN_PCI18 (uint8_t*)&RPINR38 // PWM Input 18
649 #define PPSIN_PCI12 (uint8_t*)&RPINR42 // PWM Input 12
650 #define PPSIN_PCI13 (uint8_t*)&RPINR42+1 // PWM Input 13
651 #define PPSIN_PCI14 (uint8_t*)&RPINR43 // PWM Input 14
652 #define PPSIN_PCI15 (uint8_t*)&RPINR43+1 // PWM Input 15
653 #define PPSIN_PCI16 (uint8_t*)&RPINR44 // PWM Input 16
654 #define PPSIN_SENT1 (uint8_t*)&RPINR44+1 // SENT1 Input
655 #define PPSIN_SENT2 (uint8_t*)&RPINR45 // SENT2 Input
656 #define PPSIN_CLCINA (uint8_t*)&RPINR45+1 // CLC Input A
657 #define PPSIN_CLCINB (uint8_t*)&RPINR46 // CLC Input B
658 #define PPSIN_CLCINC (uint8_t*)&RPINR46+1 // CLC Input C
659 #define PPSIN_CLCIND (uint8_t*)&RPINR47 // CLC Input D
660 #define PPSIN_ADCTRG (uint8_t*)&RPINR47+1 // ADC Trigger Input (ADTRIG31)
661 #define PPSIN_OCFD (uint8_t*)&RPINR48 // xCCP Fault D
662 #define PPSIN_U1CTS (uint8_t*)&RPINR48+1 // UART1 Clear-to-Send
663 #define PPSIN_U2CTS (uint8_t*)&RPINR49 // UART2 Clear-to-Send
664 #define PPSIN_U3CTS (uint8_t*)&RPINR49+1 // UART3 Clear-to-Send
665 
666 /* Specific declarations for virtual, remappable pins */
667 // ToDo: Add support of vitual pins, tailored to device families.
668 // The code below requires different device family macros
669 
670 //#if defined (__P33SMPS_CH_SLV__)
671 //
672 // #define PPS_RPV0 (170U)
673 // #define PPS_RPV1 (171U)
674 // #define PPS_RPV2 (172U)
675 // #define PPS_RPV3 (173U)
676 // #define PPS_RPV4 (174U)
677 // #define PPS_RPV5 (175U)
678 //
679 //#elif defined (__P33SMPS_CH_MSTR__)
680 //
681 // #define PPS_RPV0 (176U)
682 // #define PPS_RPV1 (177U)
683 // #define PPS_RPV2 (178U)
684 // #define PPS_RPV3 (179U)
685 // #define PPS_RPV4 (180U)
686 // #define PPS_RPV5 (181U)
687 //
688 //#elif defined (__P33SMPS_CK__)
689 //
690 //
691 //#else
692 //
693 // #pragma message "error: === p33c_pps: selected device type not supported ==="
694 //
695 //#endif
696 
697 // PROTOTYPES FOR p33c_pps
698 
699 extern volatile uint16_t PPS_RemapOutput(volatile uint8_t pinno, volatile uint8_t peripheral);
700 extern volatile uint16_t PPS_UnmapOutput(volatile uint8_t pinno);
701 extern volatile uint16_t PPS_RemapInput(volatile uint8_t pinno, volatile uint8_t *peripheral);
702 extern volatile uint16_t PPS_UnmapInput(volatile uint8_t *peripheral);
703 extern volatile uint16_t PPS_LockIO(void);
704 extern volatile uint16_t PPS_UnlockIO(void);
705 
706 #endif // end of MCAL_P33C_PPS_ABSTRACTION_DRIVER_H
707 // End of File
708 
PPS_UnmapInput
volatile uint16_t PPS_UnmapInput(volatile uint8_t *peripheral)
Disconnects a pin from a digital function input.
Definition: p33c_pps.c:240
PPS_LockIO
volatile uint16_t PPS_LockIO(void)
Locks the Peripheral Pin Select Configuration registers against accidental changes.
Definition: p33c_pps.c:75
PPS_UnlockIO
volatile uint16_t PPS_UnlockIO(void)
Unlocks the Peripheral Pin Select Configuration registers to enable changes.
Definition: p33c_pps.c:102
PPS_RemapInput
volatile uint16_t PPS_RemapInput(volatile uint8_t pinno, volatile uint8_t *peripheral)
Assigns a pin to a digital function input.
Definition: p33c_pps.c:174
PPS_RemapOutput
volatile uint16_t PPS_RemapOutput(volatile uint8_t pinno, volatile uint8_t peripheral)
Assigns a digital function output to a pin.
Definition: p33c_pps.c:133
PPS_UnmapOutput
volatile uint16_t PPS_UnmapOutput(volatile uint8_t pinno)
Disconnects a pin from a digital function output.
Definition: p33c_pps.c:207