gpio.h
Go to the documentation of this file.
1 #ifndef __GPIO_H__
2 #define __GPIO_H__
3 
4 //*****************************************************************************
5 //
8 //
9 //*****************************************************************************
10 
11 //*****************************************************************************
12 //
13 // If building with a C++ compiler, make all of the definitions in this header
14 // have a C binding.
15 //
16 //*****************************************************************************
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21 
22 #include <msp.h>
23 #include <stdint.h>
24 
25 #define GPIO_PORT_P1 1
26 #define GPIO_PORT_P2 2
27 #define GPIO_PORT_P3 3
28 #define GPIO_PORT_P4 4
29 #define GPIO_PORT_P5 5
30 #define GPIO_PORT_P6 6
31 #define GPIO_PORT_P7 7
32 #define GPIO_PORT_P8 8
33 #define GPIO_PORT_P9 9
34 #define GPIO_PORT_P10 10
35 #define GPIO_PORT_PA 1
36 #define GPIO_PORT_PB 3
37 #define GPIO_PORT_PC 5
38 #define GPIO_PORT_PD 7
39 #define GPIO_PORT_PE 9
40 #define GPIO_PORT_PJ 11
41 
42 
43 #define GPIO_PIN0 (0x0001)
44 #define GPIO_PIN1 (0x0002)
45 #define GPIO_PIN2 (0x0004)
46 #define GPIO_PIN3 (0x0008)
47 #define GPIO_PIN4 (0x0010)
48 #define GPIO_PIN5 (0x0020)
49 #define GPIO_PIN6 (0x0040)
50 #define GPIO_PIN7 (0x0080)
51 #define GPIO_PIN8 (0x0100)
52 #define GPIO_PIN9 (0x0200)
53 #define GPIO_PIN10 (0x0400)
54 #define GPIO_PIN11 (0x0800)
55 #define GPIO_PIN12 (0x1000)
56 #define GPIO_PIN13 (0x2000)
57 #define GPIO_PIN14 (0x4000)
58 #define GPIO_PIN15 (0x8000)
59 #define PIN_ALL8 (0xFF)
60 #define PIN_ALL16 (0xFFFF)
61 
62 #define GPIO_PRIMARY_MODULE_FUNCTION (0x01)
63 #define GPIO_SECONDARY_MODULE_FUNCTION (0x02)
64 #define GPIO_TERTIARY_MODULE_FUNCTION (0x03)
65 
66 #define GPIO_HIGH_TO_LOW_TRANSITION (0x01)
67 #define GPIO_LOW_TO_HIGH_TRANSITION (0x00)
68 
69 #define GPIO_INPUT_PIN_HIGH (0x01)
70 #define GPIO_INPUT_PIN_LOW (0x00)
71 
72 //*****************************************************************************
73 //
74 // Prototypes for the APIs.
75 //
76 //*****************************************************************************
77 
78 //*****************************************************************************
79 //
120 //
121 //*****************************************************************************
122 extern void GPIO_setAsOutputPin(uint_fast8_t selectedPort,
123  uint_fast16_t selectedPins);
124 
125 //*****************************************************************************
126 //
168 //
169 //*****************************************************************************
170 extern void GPIO_setAsInputPin(uint_fast8_t selectedPort,
171  uint_fast16_t selectedPins);
172 
173 //*****************************************************************************
174 //
227 //
228 //*****************************************************************************
230  uint_fast8_t selectedPort, uint_fast16_t selectedPins,
231  uint_fast8_t mode);
232 
233 //*****************************************************************************
234 //
287 //
288 //*****************************************************************************
290  uint_fast8_t selectedPort, uint_fast16_t selectedPins,
291  uint_fast8_t mode);
292 
293 //*****************************************************************************
294 //
335 //
336 //*****************************************************************************
337 extern void GPIO_setOutputHighOnPin(uint_fast8_t selectedPort,
338  uint_fast16_t selectedPins);
339 
340 //*****************************************************************************
341 //
380 //
381 //*****************************************************************************
382 extern void GPIO_setOutputLowOnPin(uint_fast8_t selectedPort,
383  uint_fast16_t selectedPins);
384 
385 //*****************************************************************************
386 //
427 //
428 //*****************************************************************************
429 extern void GPIO_toggleOutputOnPin(uint_fast8_t selectedPort,
430  uint_fast16_t selectedPins);
431 
432 //*****************************************************************************
433 //
476 //
477 //*****************************************************************************
478 extern void GPIO_setAsInputPinWithPullDownResistor(uint_fast8_t selectedPort,
479  uint_fast16_t selectedPins);
480 
481 //*****************************************************************************
482 //
525 //
526 //*****************************************************************************
527 extern void GPIO_setAsInputPinWithPullUpResistor(uint_fast8_t selectedPort,
528  uint_fast16_t selectedPins);
529 
530 //*****************************************************************************
531 //
573 //
574 //*****************************************************************************
575 extern uint8_t GPIO_getInputPinValue(uint_fast8_t selectedPort,
576  uint_fast16_t selectedPins);
577 
578 //*****************************************************************************
579 //
612 //
613 //*****************************************************************************
614 extern void GPIO_enableInterrupt(uint_fast8_t selectedPort,
615  uint_fast16_t selectedPins);
616 
617 //*****************************************************************************
618 //
651 //
652 //*****************************************************************************
653 extern void GPIO_disableInterrupt(uint_fast8_t selectedPort,
654  uint_fast16_t selectedPins);
655 
656 //*****************************************************************************
657 //
706 //
707 //*****************************************************************************
708 extern uint_fast16_t GPIO_getInterruptStatus(uint_fast8_t selectedPort,
709  uint_fast16_t selectedPins);
710 
711 //*****************************************************************************
712 //
745 //
746 //*****************************************************************************
747 extern void GPIO_clearInterruptFlag(uint_fast8_t selectedPort,
748  uint_fast16_t selectedPins);
749 
750 //*****************************************************************************
751 //
799 //
800 //*****************************************************************************
801 extern void GPIO_interruptEdgeSelect(uint_fast8_t selectedPort,
802  uint_fast16_t selectedPins, uint_fast8_t edgeSelect);
803 
804 //*****************************************************************************
805 //
847 //
848 //*****************************************************************************
849 extern uint_fast16_t GPIO_getEnabledInterruptStatus(uint_fast8_t selectedPort);
850 
851 
852 //*****************************************************************************
853 //
873 //
874 //*****************************************************************************
875 extern void GPIO_registerInterrupt(uint_fast8_t selectedPort,
876  void (*intHandler)(void));
877 
878 //*****************************************************************************
879 //
892 //
893 //*****************************************************************************
894 extern void GPIO_unregisterInterrupt(uint_fast8_t selectedPort);
895 
896 //*****************************************************************************
897 //
928 //
929 //*****************************************************************************
930 extern void GPIO_setDriveStrengthHigh(uint_fast8_t selectedPort,
931  uint_fast8_t selectedPins);
932 
933 //*****************************************************************************
934 //
965 //
966 //*****************************************************************************
967 extern void GPIO_setDriveStrengthLow(uint_fast8_t selectedPort,
968  uint_fast8_t selectedPins);
969 
970 /* Backwards Compatibility Layer */
971 #define GPIO_selectInterruptEdge GPIO_interruptEdgeSelect
972 #define GPIO_clearInterrupt GPIO_clearInterruptFlag
973 
974 //*****************************************************************************
975 //
976 // Mark the end of the C bindings section for C++ compilers.
977 //
978 //*****************************************************************************
979 #ifdef __cplusplus
980 }
981 #endif
982 
983 //*****************************************************************************
984 //
985 // Close the Doxygen group.
987 //
988 //*****************************************************************************
989 
990 #endif // __GPIO_H__
void GPIO_setAsPeripheralModuleFunctionInputPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins, uint_fast8_t mode)
This function configures the peripheral module function in the input direction for the selected pin f...
Definition: gpio.c:94
void GPIO_setAsPeripheralModuleFunctionOutputPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins, uint_fast8_t mode)
This function configures the peripheral module function in the output direction for the selected pin ...
Definition: gpio.c:69
uint8_t GPIO_getInputPinValue(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function gets the input value on the selected pin.
Definition: gpio.c:177
uint_fast16_t GPIO_getEnabledInterruptStatus(uint_fast8_t selectedPort)
This function gets the interrupt status of the provided PIN and masks it with the interrupts that are...
Definition: gpio.c:244
void GPIO_setDriveStrengthLow(uint_fast8_t selectedPort, uint_fast8_t selectedPins)
Definition: gpio.c:287
uint_fast16_t GPIO_getInterruptStatus(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function gets the interrupt status of the selected pin.
Definition: gpio.c:210
void GPIO_interruptEdgeSelect(uint_fast8_t selectedPort, uint_fast16_t selectedPins, uint_fast8_t edgeSelect)
This function selects on what edge the port interrupt flag should be set for a transition.
Definition: gpio.c:231
void GPIO_toggleOutputOnPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function toggles the output on the selected Pin.
Definition: gpio.c:138
void GPIO_registerInterrupt(uint_fast8_t selectedPort, void(*intHandler)(void))
Definition: gpio.c:298
void GPIO_setAsInputPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function configures the selected Pin as input pin.
Definition: gpio.c:58
void GPIO_clearInterruptFlag(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function clears the interrupt flag on the selected pin.
Definition: gpio.c:220
void GPIO_setAsOutputPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function configures the selected Pin as output pin.
Definition: gpio.c:48
void GPIO_setOutputLowOnPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function sets output LOW on the selected Pin.
Definition: gpio.c:128
void GPIO_setDriveStrengthHigh(uint_fast8_t selectedPort, uint_fast8_t selectedPins)
Definition: gpio.c:276
void GPIO_setAsInputPinWithPullUpResistor(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function sets the selected Pin in input Mode with Pull Up resistor.
Definition: gpio.c:163
void GPIO_enableInterrupt(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function enables the port interrupt on the selected pin.
Definition: gpio.c:191
void GPIO_setOutputHighOnPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function sets output HIGH on the selected Pin.
Definition: gpio.c:118
void GPIO_disableInterrupt(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function disables the port interrupt on the selected pin.
Definition: gpio.c:200
void GPIO_setAsInputPinWithPullDownResistor(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
This function sets the selected Pin in input Mode with Pull Down resistor.
Definition: gpio.c:148
void GPIO_unregisterInterrupt(uint_fast8_t selectedPort)
Definition: gpio.c:316

Copyright 2016, Texas Instruments Incorporated