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