iLLD_TC27xC  1.0
IfxPort_Io.h
Go to the documentation of this file.
1 /**
2  * \file IfxPort_Io.h
3  * \brief PORT IO details
4  * \ingroup IfxLld_Port
5  *
6  * \version iLLD_0_1_0_10
7  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8  *
9  *
10  * IMPORTANT NOTICE
11  *
12  *
13  * Infineon Technologies AG (Infineon) is supplying this file for use
14  * exclusively with Infineon's microcontroller products. This file can be freely
15  * distributed within development tools that are supporting such microcontroller
16  * products.
17  *
18  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23  *
24  * \defgroup IfxLld_Port_Io_Usage How to use the PORT I/O driver?
25  * \ingroup IfxLld_Port
26  *
27  * The PORT I/O driver provides several functions to easily configure and read pins.
28  * The configuration includes input/output, mode, pad driver strength and state. For referencing the pins and their ports a \ref IfxPort_PinMap is available as well.
29  *
30  * In the following sections it will be described, how to integrate the driver into the application framework.
31  *
32  * \section IfxLld_Port_Io_Preparation Preparation
33  * \subsection IfxLld_Port_Io_Include Include Files
34  *
35  * Include following header file into your C code:
36  * \code
37  * #include <Port/Io/IfxPort_Io.h>
38  * \endcode
39  *
40  * \subsection IfxLld_Port_Io_Variables Conifguration Table
41  *
42  * Specify the used pins, their modes and (for outputs) the pad driver strength:
43  * <br> Note: For inputs the pad driver strength is only a dummy.
44  * \code
45  * const IfxPort_Io_ConfigPin configPin[] = {
46  * {&IfxPort_P00_0, IfxPort_Mode_inputPullDown, IfxPort_PadDriver_cmosAutomotiveSpeed1}, // P00.0
47  * {&IfxPort_P33_0, IfxPort_Mode_outputPushPullGeneral, IfxPort_PadDriver_cmosAutomotiveSpeed1}, // P33.0
48  * };
49  * \endcode
50  *
51  * Note: the IfxPort_* pins are defined in \ref IfxPort_PinMap
52  *
53  * \subsection IfxLld_Port_Io_Init Port Initialisation
54  *
55  * Assemble the final configuration structure:
56  *
57  * \code
58  * const IfxPort_Io_Config conf = {
59  * sizeof(configPin)/sizeof(IfxPort_Io_ConfigPin),
60  * (IfxPort_Io_ConfigPin *)configPin
61  * };
62  * \endcode
63  *
64  * Call the initialisation function:
65  *
66  * \code
67  * IfxPort_Io_initModule(&conf);
68  * \endcode
69  *
70  * Now the pins are configured as specified.
71  *
72  * \section IfxLld_Port_Io_MiscFunctions Misc. Functions of the Standard Layer
73  *
74  * \subsection IfxLld_Port_Io_Mode Pin Mode Configuration
75  *
76  * Generally, you can use one function for both inputs and outputs to set the desired mode.
77  *
78  * \code
79  * // configure P33.0 as general output
80  * IfxPort_setPinMode(&MODULE_P33, 0, IfxPort_Mode_outputPushPullGeneral);
81  * \endcode
82  *
83  * For inputs use the IfxPort_setPinModeInput function:
84  *
85  * \code
86  * // configure P33.0 as input with pullUp
87  * IfxPort_setPinModeInput(&MODULE_P33, 0, IfxPort_InputMode_pullUp);
88  * \endcode
89  *
90  * For outputs use the IfxPort_setModeOutput function:
91  *
92  * \code
93  * // configure P33.0 as output in general pushPull mode
94  * IfxPort_setPinModeOutput(&MODULE_P33, 0, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
95  * \endcode
96  *
97  * If the pin is an output, the pad driver should be configured as well:
98  *
99  * \code
100  * IfxPort_setPinPadDriver(&MODULE_P33, 0, IfxPort_PadDriver_cmosAutomotiveSpeed1);
101  * \endcode
102  *
103  * \subsection IfxLld_Port_Io_Input Reading Input State
104  * Read the state of a single pin:
105  * \code
106  * uint8 state = IfxPort_getPinState(&MODULE_P33, 0); // read P33.0
107  * \endcode
108  *
109  * \subsection IfxLld_Port_Io_Output Setting Output State
110  *
111  * Generally, you can use one function to set an output pin high or low or to toggle it.
112  *
113  * \code
114  * IfxPort_setPinState(&MODULE_P33, 0, IfxPort_State_toggled); // toggle P33.0
115  * \endcode
116  *
117  * An output pin can be set high as following:
118  * \code
119  * IfxPort_setPinHigh(&MODULE_P33, 0); // P33.0 = 1
120  * \endcode
121  *
122  * An output pin can be set low as following:
123  * \code
124  * IfxPort_setPinLow(&MODULE_P33, 0); // P33.0 = 0
125  * \endcode
126  *
127  * \subsection IfxLld_Port_Io_Emergency Configure Emergency Function
128  *
129  * Enable emergency stop for P33.0:
130  * \code
131  * IfxPort_enableEmergencyStop(&MODULE_P33, 0);
132  * \endcode
133  *
134  * The driver also provides a function to disable this feature.
135  *
136  * \defgroup IfxLld_Port_Io Interface Driver
137  * \ingroup IfxLld_Port
138  * \defgroup IfxLld_Port_Io_DataStructures Data Structures
139  * \ingroup IfxLld_Port_Io
140  * \defgroup IfxLld_Port_Io_ModuleFunctions Module Functions
141  * \ingroup IfxLld_Port_Io
142  */
143 
144 #ifndef IFXPORT_IO_H
145 #define IFXPORT_IO_H 1
146 
147 /******************************************************************************/
148 /*----------------------------------Includes----------------------------------*/
149 /******************************************************************************/
150 
151 #include "Port/Std/IfxPort.h"
152 #include "_PinMap/IfxPort_PinMap.h"
153 
154 /******************************************************************************/
155 /*-----------------------------Data Structures--------------------------------*/
156 /******************************************************************************/
157 
158 /** \addtogroup IfxLld_Port_Io_DataStructures
159  * \{ */
160 typedef struct
161 {
162  const IfxPort_Pin *pin;
166 
167 /** \} */
168 
169 /** \addtogroup IfxLld_Port_Io_DataStructures
170  * \{ */
171 typedef struct
172 {
176 
177 /** \} */
178 
179 /** \addtogroup IfxLld_Port_Io_ModuleFunctions
180  * \{ */
181 
182 /******************************************************************************/
183 /*-------------------------Global Function Prototypes-------------------------*/
184 /******************************************************************************/
185 
186 /**
187  * \return None
188  */
190 
191 /** \} */
192 
193 #endif /* IFXPORT_IO_H */