2020-2021 Sunseeker Telemetry and Lighting System
gpio.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // gpio.h - Driver for the GPIO Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_GPIO_H__
8 #define __MSP430WARE_GPIO_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_PORT1_R__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the selectedPort parameter
28 // for functions: GPIO_setAsOutputPin(), GPIO_setAsInputPin(),
29 // GPIO_setAsPeripheralModuleFunctionOutputPin(),
30 // GPIO_setAsPeripheralModuleFunctionInputPin(), GPIO_setOutputHighOnPin(),
31 // GPIO_setOutputLowOnPin(), GPIO_toggleOutputOnPin(),
32 // GPIO_setAsInputPinWithPullDownResistor(),
33 // GPIO_setAsInputPinWithPullUpResistor(), GPIO_getInputPinValue(),
34 // GPIO_selectInterruptEdge(), GPIO_setDriveStrength(), GPIO_enableInterrupt(),
35 // GPIO_disableInterrupt(), GPIO_getInterruptStatus(), and
36 // GPIO_clearInterrupt().
37 //
38 //*****************************************************************************
39 #define GPIO_PORT_P1 1
40 #define GPIO_PORT_P2 2
41 #define GPIO_PORT_P3 3
42 #define GPIO_PORT_P4 4
43 #define GPIO_PORT_P5 5
44 #define GPIO_PORT_P6 6
45 #define GPIO_PORT_P7 7
46 #define GPIO_PORT_P8 8
47 #define GPIO_PORT_P9 9
48 #define GPIO_PORT_P10 10
49 #define GPIO_PORT_P11 11
50 #define GPIO_PORT_PA 1
51 #define GPIO_PORT_PB 3
52 #define GPIO_PORT_PC 5
53 #define GPIO_PORT_PD 7
54 #define GPIO_PORT_PE 9
55 #define GPIO_PORT_PF 11
56 #define GPIO_PORT_PJ 13
57 
58 //*****************************************************************************
59 //
60 // The following are values that can be passed to the selectedPins parameter
61 // for functions: GPIO_setAsOutputPin(), GPIO_setAsInputPin(),
62 // GPIO_setAsPeripheralModuleFunctionOutputPin(),
63 // GPIO_setAsPeripheralModuleFunctionInputPin(), GPIO_setOutputHighOnPin(),
64 // GPIO_setOutputLowOnPin(), GPIO_toggleOutputOnPin(),
65 // GPIO_setAsInputPinWithPullDownResistor(),
66 // GPIO_setAsInputPinWithPullUpResistor(), GPIO_getInputPinValue(),
67 // GPIO_enableInterrupt(), GPIO_disableInterrupt(), GPIO_getInterruptStatus(),
68 // GPIO_clearInterrupt(), GPIO_selectInterruptEdge(), and
69 // GPIO_setDriveStrength() as well as returned by the GPIO_getInterruptStatus()
70 // function.
71 //
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 GPIO_PIN_ALL8 (0xFF)
90 #define GPIO_PIN_ALL16 (0xFFFF)
91 
92 //*****************************************************************************
93 //
94 // The following are values that can be passed to the edgeSelect parameter for
95 // functions: GPIO_selectInterruptEdge().
96 //
97 //*****************************************************************************
98 #define GPIO_HIGH_TO_LOW_TRANSITION (0x01)
99 #define GPIO_LOW_TO_HIGH_TRANSITION (0x00)
100 
101 //*****************************************************************************
102 //
103 // The following are values that can be passed toThe following are values that
104 // can be returned by the GPIO_getInputPinValue() function.
105 //
106 //*****************************************************************************
107 #define GPIO_INPUT_PIN_HIGH (0x01)
108 #define GPIO_INPUT_PIN_LOW (0x00)
109 
110 //*****************************************************************************
111 //
112 // The following are values that can be passed to the driveStrength parameter
113 // for functions: GPIO_setDriveStrength().
114 //
115 //*****************************************************************************
116 #define GPIO_REDUCED_OUTPUT_DRIVE_STRENGTH 0x00
117 #define GPIO_FULL_OUTPUT_DRIVE_STRENGTH 0x01
118 
119 //*****************************************************************************
120 //
121 // Prototypes for the APIs.
122 //
123 //*****************************************************************************
124 
125 //*****************************************************************************
126 //
175 //
176 //*****************************************************************************
177 extern void GPIO_setAsOutputPin(uint8_t selectedPort,
178  uint16_t selectedPins);
179 
180 //*****************************************************************************
181 //
231 //
232 //*****************************************************************************
233 extern void GPIO_setAsInputPin(uint8_t selectedPort,
234  uint16_t selectedPins);
235 
236 //*****************************************************************************
237 //
290 //
291 //*****************************************************************************
292 extern void GPIO_setAsPeripheralModuleFunctionOutputPin(uint8_t selectedPort,
293  uint16_t selectedPins);
294 
295 //*****************************************************************************
296 //
349 //
350 //*****************************************************************************
351 extern void GPIO_setAsPeripheralModuleFunctionInputPin(uint8_t selectedPort,
352  uint16_t selectedPins);
353 
354 //*****************************************************************************
355 //
404 //
405 //*****************************************************************************
406 extern void GPIO_setOutputHighOnPin(uint8_t selectedPort,
407  uint16_t selectedPins);
408 
409 //*****************************************************************************
410 //
459 //
460 //*****************************************************************************
461 extern void GPIO_setOutputLowOnPin(uint8_t selectedPort,
462  uint16_t selectedPins);
463 
464 //*****************************************************************************
465 //
514 //
515 //*****************************************************************************
516 extern void GPIO_toggleOutputOnPin(uint8_t selectedPort,
517  uint16_t selectedPins);
518 
519 //*****************************************************************************
520 //
571 //
572 //*****************************************************************************
573 extern void GPIO_setAsInputPinWithPullDownResistor(uint8_t selectedPort,
574  uint16_t selectedPins);
575 
576 //*****************************************************************************
577 //
628 //
629 //*****************************************************************************
630 extern void GPIO_setAsInputPinWithPullUpResistor(uint8_t selectedPort,
631  uint16_t selectedPins);
632 
633 //*****************************************************************************
634 //
684 //
685 //*****************************************************************************
686 extern uint8_t GPIO_getInputPinValue(uint8_t selectedPort,
687  uint16_t selectedPins);
688 
689 //*****************************************************************************
690 //
740 //
741 //*****************************************************************************
742 extern void GPIO_enableInterrupt(uint8_t selectedPort,
743  uint16_t selectedPins);
744 
745 //*****************************************************************************
746 //
796 //
797 //*****************************************************************************
798 extern void GPIO_disableInterrupt(uint8_t selectedPort,
799  uint16_t selectedPins);
800 
801 //*****************************************************************************
802 //
870 //
871 //*****************************************************************************
872 extern uint16_t GPIO_getInterruptStatus(uint8_t selectedPort,
873  uint16_t selectedPins);
874 
875 //*****************************************************************************
876 //
926 //
927 //*****************************************************************************
928 extern void GPIO_clearInterrupt(uint8_t selectedPort,
929  uint16_t selectedPins);
930 
931 //*****************************************************************************
932 //
989 //
990 //*****************************************************************************
991 extern void GPIO_selectInterruptEdge(uint8_t selectedPort,
992  uint16_t selectedPins,
993  uint8_t edgeSelect);
994 
995 //*****************************************************************************
996 //
1051 //
1052 //*****************************************************************************
1053 extern void GPIO_setDriveStrength(uint8_t selectedPort,
1054  uint16_t selectedPins,
1055  uint8_t driveStrength);
1056 
1057 //*****************************************************************************
1058 //
1059 // Mark the end of the C bindings section for C++ compilers.
1060 //
1061 //*****************************************************************************
1062 #ifdef __cplusplus
1063 }
1064 #endif
1065 
1066 #endif
1067 #endif // __MSP430WARE_GPIO_H__
GPIO_setOutputHighOnPin(GPIO_PORT_LED1|GPIO_PORT_LED2, GPIO_PIN_LED1|GPIO_PIN_LED2)
GPIO_setOutputLowOnPin(GPIO_PORT_LED1|GPIO_PORT_LED2, GPIO_PIN_LED1|GPIO_PIN_LED2)