]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/driverlib/gpio.h
Update MSP432 projects to use updated driver library files.
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / driverlib / gpio.h
1 /*
2  * -------------------------------------------
3  *    MSP432 DriverLib - v3_10_00_09 
4  * -------------------------------------------
5  *
6  * --COPYRIGHT--,BSD,BSD
7  * Copyright (c) 2014, Texas Instruments Incorporated
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * *  Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  *
17  * *  Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * *  Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  * --/COPYRIGHT--*/
37 #ifndef __GPIO_H__
38 #define __GPIO_H__
39
40 //*****************************************************************************
41 //
42 //! \addtogroup gpio_api
43 //! @{
44 //
45 //*****************************************************************************
46
47 //*****************************************************************************
48 //
49 // If building with a C++ compiler, make all of the definitions in this header
50 // have a C binding.
51 //
52 //*****************************************************************************
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57
58 #include <msp.h>
59 #include <stdint.h>
60
61 #define GPIO_PORT_P1                                                          1
62 #define GPIO_PORT_P2                                                          2
63 #define GPIO_PORT_P3                                                          3
64 #define GPIO_PORT_P4                                                          4
65 #define GPIO_PORT_P5                                                          5
66 #define GPIO_PORT_P6                                                          6
67 #define GPIO_PORT_P7                                                          7
68 #define GPIO_PORT_P8                                                          8
69 #define GPIO_PORT_P9                                                          9
70 #define GPIO_PORT_P10                                                         10
71 #define GPIO_PORT_PA                                                           1
72 #define GPIO_PORT_PB                                                           3
73 #define GPIO_PORT_PC                                                           5
74 #define GPIO_PORT_PD                                                           7
75 #define GPIO_PORT_PE                                                           9
76 #define GPIO_PORT_PJ                                                          11
77
78  
79 #define GPIO_PIN0                                                      (0x0001)
80 #define GPIO_PIN1                                                      (0x0002)
81 #define GPIO_PIN2                                                      (0x0004)
82 #define GPIO_PIN3                                                      (0x0008)
83 #define GPIO_PIN4                                                      (0x0010)
84 #define GPIO_PIN5                                                      (0x0020)
85 #define GPIO_PIN6                                                      (0x0040)
86 #define GPIO_PIN7                                                      (0x0080)
87 #define GPIO_PIN8                                                      (0x0100)
88 #define GPIO_PIN9                                                      (0x0200)
89 #define GPIO_PIN10                                                     (0x0400)
90 #define GPIO_PIN11                                                     (0x0800)
91 #define GPIO_PIN12                                                     (0x1000)
92 #define GPIO_PIN13                                                     (0x2000)
93 #define GPIO_PIN14                                                     (0x4000)
94 #define GPIO_PIN15                                                     (0x8000)
95 #define PIN_ALL8                                                       (0xFF)
96 #define PIN_ALL16                                                      (0xFFFF)
97
98 #define GPIO_PRIMARY_MODULE_FUNCTION                                     (0x01)
99 #define GPIO_SECONDARY_MODULE_FUNCTION                                   (0x02)
100 #define GPIO_TERTIARY_MODULE_FUNCTION                                     (0x03)
101
102 #define GPIO_HIGH_TO_LOW_TRANSITION                                      (0x01)
103 #define GPIO_LOW_TO_HIGH_TRANSITION                                      (0x00)
104
105 #define GPIO_INPUT_PIN_HIGH                                              (0x01)
106 #define GPIO_INPUT_PIN_LOW                                               (0x00)
107
108 //*****************************************************************************
109 //
110 // Prototypes for the APIs.
111 //
112 //*****************************************************************************
113
114 //*****************************************************************************
115 //
116 //! \brief This function configures the selected Pin as output pin
117 //!
118 //! This function selected pins on a selected port as output pins.
119 //!
120 //! \param selectedPort is the selected port.
121 //!        Valid values are:
122 //!        - \b GPIO_PORT_P1
123 //!        - \b GPIO_PORT_P2
124 //!        - \b GPIO_PORT_P3
125 //!        - \b GPIO_PORT_P4
126 //!        - \b GPIO_PORT_P5
127 //!        - \b GPIO_PORT_P6
128 //!        - \b GPIO_PORT_P7
129 //!        - \b GPIO_PORT_P8
130 //!        - \b GPIO_PORT_P9
131 //!        - \b GPIO_PORT_P10
132 //!        - \b GPIO_PORT_P11
133 //!        - \b GPIO_PORT_PJ
134 //! \param selectedPins is the specified pin in the selected port.
135 //!        Mask value is the logical OR of any of the following:
136 //!        - \b GPIO_PIN0
137 //!        - \b GPIO_PIN1
138 //!        - \b GPIO_PIN2
139 //!        - \b GPIO_PIN3
140 //!        - \b GPIO_PIN4
141 //!        - \b GPIO_PIN5
142 //!        - \b GPIO_PIN6
143 //!        - \b GPIO_PIN7
144 //!        - \b GPIO_PIN8
145 //!        - \b GPIO_PIN9
146 //!        - \b GPIO_PIN10
147 //!        - \b GPIO_PIN11
148 //!        - \b GPIO_PIN12
149 //!        - \b GPIO_PIN13
150 //!        - \b GPIO_PIN14
151 //!        - \b GPIO_PIN15
152 //!
153 //! Modified bits of \b PxDIR register and bits of \b PxSEL register.
154 //!
155 //! \return None
156 //
157 //*****************************************************************************
158 extern void GPIO_setAsOutputPin(uint_fast8_t selectedPort,
159         uint_fast16_t selectedPins);
160
161 //*****************************************************************************
162 //
163 //! \brief This function configures the selected Pin as input pin
164 //!
165 //! This function selected pins on a selected port as input pins.
166 //!
167 //! \param selectedPort is the selected port.
168 //!        Valid values are:
169 //!        - \b GPIO_PORT_P1
170 //!        - \b GPIO_PORT_P2
171 //!        - \b GPIO_PORT_P3
172 //!        - \b GPIO_PORT_P4
173 //!        - \b GPIO_PORT_P5
174 //!        - \b GPIO_PORT_P6
175 //!        - \b GPIO_PORT_P7
176 //!        - \b GPIO_PORT_P8
177 //!        - \b GPIO_PORT_P9
178 //!        - \b GPIO_PORT_P10
179 //!        - \b GPIO_PORT_P11
180 //!        - \b GPIO_PORT_PJ
181 //! \param selectedPins is the specified pin in the selected port.
182 //!        Mask value is the logical OR of any of the following:
183 //!        - \b GPIO_PIN0
184 //!        - \b GPIO_PIN1
185 //!        - \b GPIO_PIN2
186 //!        - \b GPIO_PIN3
187 //!        - \b GPIO_PIN4
188 //!        - \b GPIO_PIN5
189 //!        - \b GPIO_PIN6
190 //!        - \b GPIO_PIN7
191 //!        - \b GPIO_PIN8
192 //!        - \b GPIO_PIN9
193 //!        - \b GPIO_PIN10
194 //!        - \b GPIO_PIN11
195 //!        - \b GPIO_PIN12
196 //!        - \b GPIO_PIN13
197 //!        - \b GPIO_PIN14
198 //!        - \b GPIO_PIN15
199 //!
200 //! Modified bits of \b PxDIR register, bits of \b PxREN register and bits of
201 //! \b PxSEL register.
202 //!
203 //! \return None
204 //
205 //*****************************************************************************
206 extern void GPIO_setAsInputPin(uint_fast8_t selectedPort,
207         uint_fast16_t selectedPins);
208
209 //*****************************************************************************
210 //
211 //! \brief This function configures the peripheral module function in the
212 //! output direction for the selected pin for either primary, secondary or
213 //! ternary module function modes
214 //!
215 //! This function configures the peripheral module function in the output
216 //! direction for the selected pin for either primary, secondary or ternary
217 //! module function modes. Accepted values for mode are
218 //! GPIO_PRIMARY_MODULE_FUNCTION, GPIO_SECONDARY_MODULE_FUNCTION, and
219 //! GPIO_TERTIARY_MODULE_FUNCTION
220 //!
221 //! \param selectedPort is the selected port.
222 //!        Valid values are:
223 //!        - \b GPIO_PORT_P1
224 //!        - \b GPIO_PORT_P2
225 //!        - \b GPIO_PORT_P3
226 //!        - \b GPIO_PORT_P4
227 //!        - \b GPIO_PORT_P5
228 //!        - \b GPIO_PORT_P6
229 //!        - \b GPIO_PORT_P7
230 //!        - \b GPIO_PORT_P8
231 //!        - \b GPIO_PORT_P9
232 //!        - \b GPIO_PORT_P10
233 //!        - \b GPIO_PORT_P11
234 //!        - \b GPIO_PORT_PJ
235 //! \param selectedPins is the specified pin in the selected port.
236 //!        Mask value is the logical OR of any of the following:
237 //!        - \b GPIO_PIN0
238 //!        - \b GPIO_PIN1
239 //!        - \b GPIO_PIN2
240 //!        - \b GPIO_PIN3
241 //!        - \b GPIO_PIN4
242 //!        - \b GPIO_PIN5
243 //!        - \b GPIO_PIN6
244 //!        - \b GPIO_PIN7
245 //!        - \b GPIO_PIN8
246 //!        - \b GPIO_PIN9
247 //!        - \b GPIO_PIN10
248 //!        - \b GPIO_PIN11
249 //!        - \b GPIO_PIN12
250 //!        - \b GPIO_PIN13
251 //!        - \b GPIO_PIN14
252 //!        - \b GPIO_PIN15
253 //! \param mode is the specified mode that the pin should be configured for the
254 //!        module function.
255 //!        Valid values are:
256 //!        - \b GPIO_PRIMARY_MODULE_FUNCTION
257 //!        - \b GPIO_SECONDARY_MODULE_FUNCTION
258 //!        - \b GPIO_TERTIARY_MODULE_FUNCTION
259 //!
260 //! Modified bits of \b PxDIR register and bits of \b PxSEL register.
261 //!
262 //! \return None
263 //
264 //*****************************************************************************
265 extern void GPIO_setAsPeripheralModuleFunctionOutputPin(
266         uint_fast8_t selectedPort, uint_fast16_t selectedPins,
267         uint_fast8_t mode);
268
269 //*****************************************************************************
270 //
271 //! \brief This function configures the peripheral module function in the input
272 //! direction for the selected pin for either primary, secondary or ternary
273 //! module function modes.
274 //!
275 //! This function configures the peripheral module function in the input
276 //! direction for the selected pin for either primary, secondary or ternary
277 //! module function modes. Accepted values for mode are
278 //! GPIO_PRIMARY_MODULE_FUNCTION, GPIO_SECONDARY_MODULE_FUNCTION, and
279 //! GPIO_TERTIARY_MODULE_FUNCTION
280 //!
281 //! \param selectedPort is the selected port.
282 //!        Valid values are:
283 //!        - \b GPIO_PORT_P1
284 //!        - \b GPIO_PORT_P2
285 //!        - \b GPIO_PORT_P3
286 //!        - \b GPIO_PORT_P4
287 //!        - \b GPIO_PORT_P5
288 //!        - \b GPIO_PORT_P6
289 //!        - \b GPIO_PORT_P7
290 //!        - \b GPIO_PORT_P8
291 //!        - \b GPIO_PORT_P9
292 //!        - \b GPIO_PORT_P10
293 //!        - \b GPIO_PORT_P11
294 //!        - \b GPIO_PORT_PJ
295 //! \param selectedPins is the specified pin in the selected port.
296 //!        Mask value is the logical OR of any of the following:
297 //!        - \b GPIO_PIN0
298 //!        - \b GPIO_PIN1
299 //!        - \b GPIO_PIN2
300 //!        - \b GPIO_PIN3
301 //!        - \b GPIO_PIN4
302 //!        - \b GPIO_PIN5
303 //!        - \b GPIO_PIN6
304 //!        - \b GPIO_PIN7
305 //!        - \b GPIO_PIN8
306 //!        - \b GPIO_PIN9
307 //!        - \b GPIO_PIN10
308 //!        - \b GPIO_PIN11
309 //!        - \b GPIO_PIN12
310 //!        - \b GPIO_PIN13
311 //!        - \b GPIO_PIN14
312 //!        - \b GPIO_PIN15
313 //! \param mode is the specified mode that the pin should be configured for the
314 //!        module function.
315 //!        Valid values are:
316 //!        - \b GPIO_PRIMARY_MODULE_FUNCTION
317 //!        - \b GPIO_SECONDARY_MODULE_FUNCTION
318 //!        - \b GPIO_TERTIARY_MODULE_FUNCTION
319 //!
320 //! Modified bits of \b PxDIR register and bits of \b PxSEL register.
321 //!
322 //! \return None
323 //
324 //*****************************************************************************
325 extern void GPIO_setAsPeripheralModuleFunctionInputPin(
326         uint_fast8_t selectedPort, uint_fast16_t selectedPins,
327         uint_fast8_t mode);
328
329 //*****************************************************************************
330 //
331 //! \brief This function sets output HIGH on the selected Pin
332 //!
333 //! This function sets output HIGH on the selected port's pin.
334 //!
335 //! \param selectedPort is the selected port.
336 //!        Valid values are:
337 //!        - \b GPIO_PORT_P1
338 //!        - \b GPIO_PORT_P2
339 //!        - \b GPIO_PORT_P3
340 //!        - \b GPIO_PORT_P4
341 //!        - \b GPIO_PORT_P5
342 //!        - \b GPIO_PORT_P6
343 //!        - \b GPIO_PORT_P7
344 //!        - \b GPIO_PORT_P8
345 //!        - \b GPIO_PORT_P9
346 //!        - \b GPIO_PORT_P10
347 //!        - \b GPIO_PORT_P11
348 //!        - \b GPIO_PORT_PJ
349 //! \param selectedPins is the specified pin in the selected port.
350 //!        Mask value is the logical OR of any of the following:
351 //!        - \b GPIO_PIN0
352 //!        - \b GPIO_PIN1
353 //!        - \b GPIO_PIN2
354 //!        - \b GPIO_PIN3
355 //!        - \b GPIO_PIN4
356 //!        - \b GPIO_PIN5
357 //!        - \b GPIO_PIN6
358 //!        - \b GPIO_PIN7
359 //!        - \b GPIO_PIN8
360 //!        - \b GPIO_PIN9
361 //!        - \b GPIO_PIN10
362 //!        - \b GPIO_PIN11
363 //!        - \b GPIO_PIN12
364 //!        - \b GPIO_PIN13
365 //!        - \b GPIO_PIN14
366 //!        - \b GPIO_PIN15
367 //!
368 //! Modified bits of \b PxOUT register.
369 //!
370 //! \return None
371 //
372 //*****************************************************************************
373 extern void GPIO_setOutputHighOnPin(uint_fast8_t selectedPort,
374         uint_fast16_t selectedPins);
375
376 //*****************************************************************************
377 //
378 //! \brief This function sets output LOW on the selected Pin
379 //!
380 //! This function sets output LOW on the selected port's pin.
381 //!
382 //! \param selectedPort is the selected port.
383 //!        Valid values are:
384 //!        - \b GPIO_PORT_P1
385 //!        - \b GPIO_PORT_P2
386 //!        - \b GPIO_PORT_P3
387 //!        - \b GPIO_PORT_P4
388 //!        - \b GPIO_PORT_P5
389 //!        - \b GPIO_PORT_P6
390 //!        - \b GPIO_PORT_P7
391 //!        - \b GPIO_PORT_P8
392 //!        - \b GPIO_PORT_P9
393 //!        - \b GPIO_PORT_P10
394 //!        - \b GPIO_PORT_P11
395 //!        - \b GPIO_PORT_PJ
396 //! \param selectedPins is the specified pin in the selected port.
397 //!        Mask value is the logical OR of any of the following:
398 //!        - \b GPIO_PIN0
399 //!        - \b GPIO_PIN1
400 //!        - \b GPIO_PIN2
401 //!        - \b GPIO_PIN3
402 //!        - \b GPIO_PIN4
403 //!        - \b GPIO_PIN5
404 //!        - \b GPIO_PIN6
405 //!        - \b GPIO_PIN7
406 //!        - \b GPIO_PIN8
407 //!        - \b GPIO_PIN9
408 //!        - \b GPIO_PIN10
409 //!        - \b GPIO_PIN11
410 //!        - \b GPIO_PIN12
411 //!        - \b GPIO_PIN13
412 //!        - \b GPIO_PIN14
413 //!        - \b GPIO_PIN15
414 //!
415 //! \return None
416 //
417 //*****************************************************************************
418 extern void GPIO_setOutputLowOnPin(uint_fast8_t selectedPort,
419         uint_fast16_t selectedPins);
420
421 //*****************************************************************************
422 //
423 //! \brief This function toggles the output on the selected Pin
424 //!
425 //! This function toggles the output on the selected port's pin.
426 //!
427 //! \param selectedPort is the selected port.
428 //!        Valid values are:
429 //!        - \b GPIO_PORT_P1
430 //!        - \b GPIO_PORT_P2
431 //!        - \b GPIO_PORT_P3
432 //!        - \b GPIO_PORT_P4
433 //!        - \b GPIO_PORT_P5
434 //!        - \b GPIO_PORT_P6
435 //!        - \b GPIO_PORT_P7
436 //!        - \b GPIO_PORT_P8
437 //!        - \b GPIO_PORT_P9
438 //!        - \b GPIO_PORT_P10
439 //!        - \b GPIO_PORT_P11
440 //!        - \b GPIO_PORT_PJ
441 //! \param selectedPins is the specified pin in the selected port.
442 //!        Mask value is the logical OR of any of the following:
443 //!        - \b GPIO_PIN0
444 //!        - \b GPIO_PIN1
445 //!        - \b GPIO_PIN2
446 //!        - \b GPIO_PIN3
447 //!        - \b GPIO_PIN4
448 //!        - \b GPIO_PIN5
449 //!        - \b GPIO_PIN6
450 //!        - \b GPIO_PIN7
451 //!        - \b GPIO_PIN8
452 //!        - \b GPIO_PIN9
453 //!        - \b GPIO_PIN10
454 //!        - \b GPIO_PIN11
455 //!        - \b GPIO_PIN12
456 //!        - \b GPIO_PIN13
457 //!        - \b GPIO_PIN14
458 //!        - \b GPIO_PIN15
459 //!
460 //! Modified bits of \b PxOUT register.
461 //!
462 //! \return None
463 //
464 //*****************************************************************************
465 extern void GPIO_toggleOutputOnPin(uint_fast8_t selectedPort,
466         uint_fast16_t selectedPins);
467
468 //*****************************************************************************
469 //
470 //! \brief This function sets the selected Pin in input Mode with Pull Down
471 //! resistor
472 //!
473 //! This function sets the selected Pin in input Mode with Pull Down resistor.
474 //!
475 //! \param selectedPort is the selected port.
476 //!        Valid values are:
477 //!        - \b GPIO_PORT_P1
478 //!        - \b GPIO_PORT_P2
479 //!        - \b GPIO_PORT_P3
480 //!        - \b GPIO_PORT_P4
481 //!        - \b GPIO_PORT_P5
482 //!        - \b GPIO_PORT_P6
483 //!        - \b GPIO_PORT_P7
484 //!        - \b GPIO_PORT_P8
485 //!        - \b GPIO_PORT_P9
486 //!        - \b GPIO_PORT_P10
487 //!        - \b GPIO_PORT_P11
488 //!        - \b GPIO_PORT_PJ
489 //! \param selectedPins is the specified pin in the selected port.
490 //!        Mask value is the logical OR of any of the following:
491 //!        - \b GPIO_PIN0
492 //!        - \b GPIO_PIN1
493 //!        - \b GPIO_PIN2
494 //!        - \b GPIO_PIN3
495 //!        - \b GPIO_PIN4
496 //!        - \b GPIO_PIN5
497 //!        - \b GPIO_PIN6
498 //!        - \b GPIO_PIN7
499 //!        - \b GPIO_PIN8
500 //!        - \b GPIO_PIN9
501 //!        - \b GPIO_PIN10
502 //!        - \b GPIO_PIN11
503 //!        - \b GPIO_PIN12
504 //!        - \b GPIO_PIN13
505 //!        - \b GPIO_PIN14
506 //!        - \b GPIO_PIN15
507 //!
508 //! Modified bits of \b PxDIR register, bits of \b PxOUT register and bits of
509 //! \b PxREN register.
510 //!
511 //! \return None
512 //
513 //*****************************************************************************
514 extern void GPIO_setAsInputPinWithPullDownResistor(uint_fast8_t selectedPort,
515         uint_fast16_t selectedPins);
516
517 //*****************************************************************************
518 //
519 //! \brief This function sets the selected Pin in input Mode with Pull Up
520 //! resistor
521 //!
522 //! This function sets the selected Pin in input Mode with Pull Up resistor.
523 //!
524 //! \param selectedPort is the selected port.
525 //!        Valid values are:
526 //!        - \b GPIO_PORT_P1
527 //!        - \b GPIO_PORT_P2
528 //!        - \b GPIO_PORT_P3
529 //!        - \b GPIO_PORT_P4
530 //!        - \b GPIO_PORT_P5
531 //!        - \b GPIO_PORT_P6
532 //!        - \b GPIO_PORT_P7
533 //!        - \b GPIO_PORT_P8
534 //!        - \b GPIO_PORT_P9
535 //!        - \b GPIO_PORT_P10
536 //!        - \b GPIO_PORT_P11
537 //!        - \b GPIO_PORT_PJ
538 //! \param selectedPins is the specified pin in the selected port.
539 //!        Mask value is the logical OR of any of the following:
540 //!        - \b GPIO_PIN0
541 //!        - \b GPIO_PIN1
542 //!        - \b GPIO_PIN2
543 //!        - \b GPIO_PIN3
544 //!        - \b GPIO_PIN4
545 //!        - \b GPIO_PIN5
546 //!        - \b GPIO_PIN6
547 //!        - \b GPIO_PIN7
548 //!        - \b GPIO_PIN8
549 //!        - \b GPIO_PIN9
550 //!        - \b GPIO_PIN10
551 //!        - \b GPIO_PIN11
552 //!        - \b GPIO_PIN12
553 //!        - \b GPIO_PIN13
554 //!        - \b GPIO_PIN14
555 //!        - \b GPIO_PIN15
556 //!
557 //! Modified bits of \b PxDIR register, bits of \b PxOUT register and bits of
558 //! \b PxREN register.
559 //!
560 //! \return None
561 //
562 //*****************************************************************************
563 extern void GPIO_setAsInputPinWithPullUpResistor(uint_fast8_t selectedPort,
564         uint_fast16_t selectedPins);
565
566 //*****************************************************************************
567 //
568 //! \brief This function gets the input value on the selected pin
569 //!
570 //! This function gets the input value on the selected pin.
571 //!
572 //! \param selectedPort is the selected port.
573 //!        Valid values are:
574 //!        - \b GPIO_PORT_P1
575 //!        - \b GPIO_PORT_P2
576 //!        - \b GPIO_PORT_P3
577 //!        - \b GPIO_PORT_P4
578 //!        - \b GPIO_PORT_P5
579 //!        - \b GPIO_PORT_P6
580 //!        - \b GPIO_PORT_P7
581 //!        - \b GPIO_PORT_P8
582 //!        - \b GPIO_PORT_P9
583 //!        - \b GPIO_PORT_P10
584 //!        - \b GPIO_PORT_P11
585 //!        - \b GPIO_PORT_PJ
586 //! \param selectedPins is the specified pin in the selected port.
587 //!        Valid values are:
588 //!        - \b GPIO_PIN0
589 //!        - \b GPIO_PIN1
590 //!        - \b GPIO_PIN2
591 //!        - \b GPIO_PIN3
592 //!        - \b GPIO_PIN4
593 //!        - \b GPIO_PIN5
594 //!        - \b GPIO_PIN6
595 //!        - \b GPIO_PIN7
596 //!        - \b GPIO_PIN8
597 //!        - \b GPIO_PIN9
598 //!        - \b GPIO_PIN10
599 //!        - \b GPIO_PIN11
600 //!        - \b GPIO_PIN12
601 //!        - \b GPIO_PIN13
602 //!        - \b GPIO_PIN14
603 //!        - \b GPIO_PIN15
604 //!
605 //! \return One of the following:
606 //!         - \b GPIO_INPUT_PIN_HIGH
607 //!         - \b GPIO_INPUT_PIN_LOW
608 //!         \n indicating the status of the pin
609 //
610 //*****************************************************************************
611 extern uint8_t GPIO_getInputPinValue(uint_fast8_t selectedPort,
612         uint_fast16_t selectedPins);
613
614 //*****************************************************************************
615 //
616 //! \brief This function enables the port interrupt on the selected pin
617 //!
618 //! This function enables the port interrupt on the selected pin. Note that
619 //! only Port 1,2, A have this capability.
620 //!
621 //! \param selectedPort is the selected port.
622 //!        Valid values are:
623 //!        - \b GPIO_PORT_P1
624 //!        - \b GPIO_PORT_P2
625 //!        - \b GPIO_PORT_PA
626 //! \param selectedPins is the specified pin in the selected port.
627 //!        Mask value is the logical OR of any of the following:
628 //!        - \b GPIO_PIN0
629 //!        - \b GPIO_PIN1
630 //!        - \b GPIO_PIN2
631 //!        - \b GPIO_PIN3
632 //!        - \b GPIO_PIN4
633 //!        - \b GPIO_PIN5
634 //!        - \b GPIO_PIN6
635 //!        - \b GPIO_PIN7
636 //!        - \b GPIO_PIN8
637 //!        - \b GPIO_PIN9
638 //!        - \b GPIO_PIN10
639 //!        - \b GPIO_PIN11
640 //!        - \b GPIO_PIN12
641 //!        - \b GPIO_PIN13
642 //!        - \b GPIO_PIN14
643 //!        - \b GPIO_PIN15
644 //!
645 //! Modified bits of \b PxIE register.
646 //!
647 //! \return None
648 //
649 //*****************************************************************************
650 extern void GPIO_enableInterrupt(uint_fast8_t selectedPort,
651         uint_fast16_t selectedPins);
652
653 //*****************************************************************************
654 //
655 //! \brief This function disables the port interrupt on the selected pin
656 //!
657 //! This function disables the port interrupt on the selected pin. Note that
658 //! only Port 1,2, A have this capability.
659 //!
660 //! \param selectedPort is the selected port.
661 //!        Valid values are:
662 //!        - \b GPIO_PORT_P1
663 //!        - \b GPIO_PORT_P2
664 //!        - \b GPIO_PORT_PA
665 //! \param selectedPins is the specified pin in the selected port.
666 //!        Mask value is the logical OR of any of the following:
667 //!        - \b GPIO_PIN0
668 //!        - \b GPIO_PIN1
669 //!        - \b GPIO_PIN2
670 //!        - \b GPIO_PIN3
671 //!        - \b GPIO_PIN4
672 //!        - \b GPIO_PIN5
673 //!        - \b GPIO_PIN6
674 //!        - \b GPIO_PIN7
675 //!        - \b GPIO_PIN8
676 //!        - \b GPIO_PIN9
677 //!        - \b GPIO_PIN10
678 //!        - \b GPIO_PIN11
679 //!        - \b GPIO_PIN12
680 //!        - \b GPIO_PIN13
681 //!        - \b GPIO_PIN14
682 //!        - \b GPIO_PIN15
683 //!
684 //! Modified bits of \b PxIE register.
685 //!
686 //! \return None
687 //
688 //*****************************************************************************
689 extern void GPIO_disableInterrupt(uint_fast8_t selectedPort,
690         uint_fast16_t selectedPins);
691
692 //*****************************************************************************
693 //
694 //! \brief This function gets the interrupt status of the selected pin
695 //!
696 //! This function gets the interrupt status of the selected pin. Note that only
697 //! Port 1,2, A have this capability.
698 //!
699 //! \param selectedPort is the selected port.
700 //!        Valid values are:
701 //!        - \b GPIO_PORT_P1
702 //!        - \b GPIO_PORT_P2
703 //!        - \b GPIO_PORT_PA
704 //! \param selectedPins is the specified pin in the selected port.
705 //!        Mask value is the logical OR of any of the following:
706 //!        - \b GPIO_PIN0
707 //!        - \b GPIO_PIN1
708 //!        - \b GPIO_PIN2
709 //!        - \b GPIO_PIN3
710 //!        - \b GPIO_PIN4
711 //!        - \b GPIO_PIN5
712 //!        - \b GPIO_PIN6
713 //!        - \b GPIO_PIN7
714 //!        - \b GPIO_PIN8
715 //!        - \b GPIO_PIN9
716 //!        - \b GPIO_PIN10
717 //!        - \b GPIO_PIN11
718 //!        - \b GPIO_PIN12
719 //!        - \b GPIO_PIN13
720 //!        - \b GPIO_PIN14
721 //!        - \b GPIO_PIN15
722 //!
723 //! \return Logical OR of any of the following:
724 //!         - \b GPIO_PIN0
725 //!         - \b GPIO_PIN1
726 //!         - \b GPIO_PIN2
727 //!         - \b GPIO_PIN3
728 //!         - \b GPIO_PIN4
729 //!         - \b GPIO_PIN5
730 //!         - \b GPIO_PIN6
731 //!         - \b GPIO_PIN7
732 //!         - \b GPIO_PIN8
733 //!         - \b GPIO_PIN9
734 //!         - \b GPIO_PIN10
735 //!         - \b GPIO_PIN11
736 //!         - \b GPIO_PIN12
737 //!         - \b GPIO_PIN13
738 //!         - \b GPIO_PIN14
739 //!         - \b GPIO_PIN15
740 //!         \n indicating the interrupt status of the selected pins [Default:
741 //!         0]
742 //
743 //*****************************************************************************
744 extern uint_fast16_t GPIO_getInterruptStatus(uint_fast8_t selectedPort,
745         uint_fast16_t selectedPins);
746
747 //*****************************************************************************
748 //
749 //! \brief This function clears the interrupt flag on the selected pin
750 //!
751 //! This function clears the interrupt flag on the selected pin. Note that only
752 //! Port 1,2,A have this capability.
753 //!
754 //! \param selectedPort is the selected port.
755 //!        Valid values are:
756 //!        - \b GPIO_PORT_P1
757 //!        - \b GPIO_PORT_P2
758 //!        - \b GPIO_PORT_PA
759 //! \param selectedPins is the specified pin in the selected port.
760 //!        Mask value is the logical OR of any of the following:
761 //!        - \b GPIO_PIN0
762 //!        - \b GPIO_PIN1
763 //!        - \b GPIO_PIN2
764 //!        - \b GPIO_PIN3
765 //!        - \b GPIO_PIN4
766 //!        - \b GPIO_PIN5
767 //!        - \b GPIO_PIN6
768 //!        - \b GPIO_PIN7
769 //!        - \b GPIO_PIN8
770 //!        - \b GPIO_PIN9
771 //!        - \b GPIO_PIN10
772 //!        - \b GPIO_PIN11
773 //!        - \b GPIO_PIN12
774 //!        - \b GPIO_PIN13
775 //!        - \b GPIO_PIN14
776 //!        - \b GPIO_PIN15
777 //!
778 //! Modified bits of \b PxIFG register.
779 //!
780 //! \return None
781 //
782 //*****************************************************************************
783 extern void GPIO_clearInterruptFlag(uint_fast8_t selectedPort,
784         uint_fast16_t selectedPins);
785
786 //*****************************************************************************
787 //
788 //! \brief This function selects on what edge the port interrupt flag should be
789 //! set for a transition
790 //!
791 //! This function selects on what edge the port interrupt flag should be set
792 //! for a transition. Values for edgeSelect should be
793 //! GPIO_LOW_TO_HIGH_TRANSITION or GPIO_HIGH_TO_LOW_TRANSITION.
794 //!
795 //! \param selectedPort is the selected port.
796 //!        Valid values are:
797 //!        - \b GPIO_PORT_P1
798 //!        - \b GPIO_PORT_P2
799 //!        - \b GPIO_PORT_P3
800 //!        - \b GPIO_PORT_P4
801 //!        - \b GPIO_PORT_P5
802 //!        - \b GPIO_PORT_P6
803 //!        - \b GPIO_PORT_P7
804 //!        - \b GPIO_PORT_P8
805 //!        - \b GPIO_PORT_P9
806 //!        - \b GPIO_PORT_P10
807 //!        - \b GPIO_PORT_P11
808 //!        - \b GPIO_PORT_PJ
809 //! \param selectedPins is the specified pin in the selected port.
810 //!        Mask value is the logical OR of any of the following:
811 //!        - \b GPIO_PIN0
812 //!        - \b GPIO_PIN1
813 //!        - \b GPIO_PIN2
814 //!        - \b GPIO_PIN3
815 //!        - \b GPIO_PIN4
816 //!        - \b GPIO_PIN5
817 //!        - \b GPIO_PIN6
818 //!        - \b GPIO_PIN7
819 //!        - \b GPIO_PIN8
820 //!        - \b GPIO_PIN9
821 //!        - \b GPIO_PIN10
822 //!        - \b GPIO_PIN11
823 //!        - \b GPIO_PIN12
824 //!        - \b GPIO_PIN13
825 //!        - \b GPIO_PIN14
826 //!        - \b GPIO_PIN15
827 //! \param edgeSelect specifies what transition sets the interrupt flag
828 //!        Valid values are:
829 //!        - \b GPIO_HIGH_TO_LOW_TRANSITION
830 //!        - \b GPIO_LOW_TO_HIGH_TRANSITION
831 //!
832 //! Modified bits of \b PxIES register.
833 //!
834 //! \return None
835 //
836 //*****************************************************************************
837 extern void GPIO_interruptEdgeSelect(uint_fast8_t selectedPort,
838         uint_fast16_t selectedPins, uint_fast8_t edgeSelect);
839
840 //*****************************************************************************
841 //
842 //! \brief This function gets the interrupt status of the provided PIN and
843 //!         masks it with the interrupts that are actually enabled. This is
844 //!         useful for inside ISRs where the status of only the enabled
845 //!         interrupts needs to be checked.
846 //!
847 //! \param selectedPort is the selected port.
848 //!        Valid values are:
849 //!        - \b GPIO_PORT_P1
850 //!        - \b GPIO_PORT_P2
851 //!        - \b GPIO_PORT_P3
852 //!        - \b GPIO_PORT_P4
853 //!        - \b GPIO_PORT_P5
854 //!        - \b GPIO_PORT_P6
855 //!        - \b GPIO_PORT_P7
856 //!        - \b GPIO_PORT_P8
857 //!        - \b GPIO_PORT_P9
858 //!        - \b GPIO_PORT_P10
859 //!        - \b GPIO_PORT_P11
860 //!        - \b GPIO_PORT_PJ
861 //!
862 //! \return Logical OR of any of the following:
863 //!         - \b GPIO_PIN0
864 //!         - \b GPIO_PIN1
865 //!         - \b GPIO_PIN2
866 //!         - \b GPIO_PIN3
867 //!         - \b GPIO_PIN4
868 //!         - \b GPIO_PIN5
869 //!         - \b GPIO_PIN6
870 //!         - \b GPIO_PIN7
871 //!         - \b GPIO_PIN8
872 //!         - \b GPIO_PIN9
873 //!         - \b GPIO_PIN10
874 //!         - \b GPIO_PIN11
875 //!         - \b GPIO_PIN12
876 //!         - \b GPIO_PIN13
877 //!         - \b GPIO_PIN14
878 //!         - \b GPIO_PIN15,
879 //!         - \b PIN_ALL8,
880 //!         - \b PIN_ALL16
881 //!         \n indicating the interrupt status of the selected pins [Default:
882 //!         0]
883 //
884 //*****************************************************************************
885 extern uint_fast16_t GPIO_getEnabledInterruptStatus(uint_fast8_t selectedPort);
886
887
888 //*****************************************************************************
889 //
890 //! Registers an interrupt handler for the port interrupt.
891 //!
892 //! \param selectedPort is the port to register the interrupt handler
893 //!
894 //! \param intHandler is a pointer to the function to be called when the port
895 //! interrupt occurs.
896 //!
897 //! This function registers the handler to be called when a port
898 //! interrupt occurs. This function enables the global interrupt in the
899 //! interrupt controller; specific GPIO interrupts must be enabled
900 //! via GPIO_enableInterrupt().  It is the interrupt handler's responsibility to
901 //! clear the interrupt source via GPIO_clearInterruptFlag().
902 //!
903 //! Clock System can generate interrupts when
904 //!
905 //! \sa Interrupt_registerInterrupt() for important information about
906 //! registering interrupt handlers.
907 //!
908 //! \return None.
909 //
910 //*****************************************************************************
911 extern void GPIO_registerInterrupt(uint_fast8_t selectedPort,
912         void (*intHandler)(void));
913
914 //*****************************************************************************
915 //
916 //! Unregisters the interrupt handler for the port.
917 //!
918 //! \param selectedPort is the port to unregister the interrupt handler
919 //!
920 //! This function unregisters the handler to be called when a port
921 //! interrupt occurs.  This function also masks off the interrupt in the
922 //! interrupt controller so that the interrupt handler no longer is called.
923 //!
924 //! \sa Interrupt_registerInterrupt() for important information about
925 //! registering interrupt handlers.
926 //!
927 //! \return None.
928 //
929 //*****************************************************************************
930 extern void GPIO_unregisterInterrupt(uint_fast8_t selectedPort);
931
932 //*****************************************************************************
933 //
934 //! This function sets the drive strength to high for the selected port
935 //!
936 //!
937 //! \param selectedPort is the selected port.
938 //!             Valid values are:
939 //!             - \b GPIO_PORT_P1,
940 //!             - \b GPIO_PORT_P2,
941 //!             - \b GPIO_PORT_P3,
942 //!             - \b GPIO_PORT_P4,
943 //!             - \b GPIO_PORT_P5,
944 //!             - \b GPIO_PORT_P6,
945 //!             - \b GPIO_PORT_P7,
946 //!             - \b GPIO_PORT_P8,
947 //!             - \b GPIO_PORT_P9,
948 //!             - \b GPIO_PORT_P10,
949 //!             - \b GPIO_PORT_PJ
950 //! \param selectedPins is the specified pin in the selected port.
951 //!             Valid values are:
952 //!             - \b GPIO_PIN0,
953 //!             - \b GPIO_PIN1,
954 //!             - \b GPIO_PIN2,
955 //!             - \b GPIO_PIN3,
956 //!             - \b GPIO_PIN4,
957 //!             - \b GPIO_PIN5,
958 //!             - \b GPIO_PIN6,
959 //!             - \b GPIO_PIN7,
960 //!             - \b GPIO_PIN8,
961 //!             - \b PIN_ALL8,
962 //!
963 //! \return None
964 //
965 //*****************************************************************************
966 extern void GPIO_setDriveStrengthHigh(uint_fast8_t selectedPort,
967         uint_fast8_t selectedPins);
968
969 //*****************************************************************************
970 //
971 //! This function sets the drive strength to low for the selected port
972 //!
973 //!
974 //! \param selectedPort is the selected port.
975 //!             Valid values are:
976 //!             - \b GPIO_PORT_P1,
977 //!             - \b GPIO_PORT_P2,
978 //!             - \b GPIO_PORT_P3,
979 //!             - \b GPIO_PORT_P4,
980 //!             - \b GPIO_PORT_P5,
981 //!             - \b GPIO_PORT_P6,
982 //!             - \b GPIO_PORT_P7,
983 //!             - \b GPIO_PORT_P8,
984 //!             - \b GPIO_PORT_P9,
985 //!             - \b GPIO_PORT_P10,
986 //!             - \b GPIO_PORT_PJ
987 //! \param selectedPins is the specified pin in the selected port.
988 //!             Valid values are:
989 //!             - \b GPIO_PIN0,
990 //!             - \b GPIO_PIN1,
991 //!             - \b GPIO_PIN2,
992 //!             - \b GPIO_PIN3,
993 //!             - \b GPIO_PIN4,
994 //!             - \b GPIO_PIN5,
995 //!             - \b GPIO_PIN6,
996 //!             - \b GPIO_PIN7,
997 //!             - \b GPIO_PIN8,
998 //!             - \b PIN_ALL8,
999 //!
1000 //! \return None
1001 //
1002 //*****************************************************************************
1003 extern void GPIO_setDriveStrengthLow(uint_fast8_t selectedPort,
1004         uint_fast8_t selectedPins);
1005         
1006 /* Backwards Compatibility Layer */
1007 #define  GPIO_selectInterruptEdge       GPIO_interruptEdgeSelect
1008 #define  GPIO_clearInterrupt            GPIO_clearInterruptFlag
1009   
1010 //*****************************************************************************
1011 //
1012 // Mark the end of the C bindings section for C++ compilers.
1013 //
1014 //*****************************************************************************
1015 #ifdef __cplusplus
1016 }
1017 #endif
1018
1019 //*****************************************************************************
1020 //
1021 // Close the Doxygen group.
1022 //! @}
1023 //
1024 //*****************************************************************************
1025
1026 #endif // __GPIO_H__