SysIo  1.9.0
Embedded Library and tools
gpio_c.h
1 
8 #ifndef _SYSIO_GPIO_C_H_
9 #define _SYSIO_GPIO_C_H_
10 #include <sysio/defs.h>
11 
12 #ifndef __DOXYGEN__
13 
20 /*
21  * @example gpio/write/sysio_test_gpio_write.c
22  * Allumage de leds
23  * @example gpio/read/sysio_test_gpio_read.c
24  * Lecture de boutons poussoirs
25  * @example gpio/getmode/sysio_test_gpio_getmode.c
26  * Lecture du mode de toutes les broches du GPIO
27  */
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* constants ================================================================ */
37 #define GPIO_PIN_UNUSED (-1)
38 
45 typedef enum {
46  eModeInput = 0,
47  eModeOutput = 1,
48  eModeAlt0 = 4,
49  eModeAlt1 = 5,
50  eModeAlt2 = 6,
51  eModeAlt3 = 7,
52  eModeAlt4 = 3,
53  eModeAlt5 = 2,
54  eModeFunc2 = 2,
55  eModeFunc3 = 3,
56  eModeFunc4 = 4,
57  eModeFunc5 = 5,
58  eModeFunc6 = 6,
59  eModeDisabled = 7,
60  eModePwm = 0x8002,
61  eModeError = -1
62 }
63  eGpioMode;
64 
69 typedef enum {
70  ePullOff = 0,
71  ePullDown = 1,
72  ePullUp = 2,
73  ePullError = -1
74 } eGpioPull;
75 
80 typedef enum {
81  eNumberingLogical = 0,
82  eNumberingMcu = 1,
83  eNumberingPhysical = 2,
84  eNumberingSystem = 3,
85 } eGpioNumbering;
86 
87 /* structures =============================================================== */
88 
94 typedef struct xGpio xGpio;
95 
96 
97 /* internal public functions ================================================ */
105 xGpio * xGpioOpen (void * args);
106 
115 int iGpioClose (xGpio * gpio);
116 
123 bool bGpioIsOpen (const xGpio * gpio);
124 
131 int iGpioSetNumbering (eGpioNumbering eNum, xGpio * gpio);
132 
139 eGpioNumbering eGpioGetNumbering (const xGpio * gpio);
140 
146 const char * sGpioNumberingToStr (eGpioNumbering eNum);
147 
159 int iGpioSetMode (int iPin, eGpioMode eMode, xGpio * gpio);
160 
171 eGpioMode eGpioGetMode (int iPin, xGpio * gpio);
172 
181 int iGpioSetPull (int iPin, eGpioPull ePull, xGpio * gpio);
182 
190 eGpioPull eGpioGetPull (int iPin, xGpio * gpio);
191 
199 bool bGpioIsValid (int iPin, xGpio * gpio);
200 
207 int iGpioGetSize (const xGpio * gpio);
208 
217 int iGpioWrite (int iPin, bool bValue, xGpio * gpio);
218 
226 int iGpioToggle (int iPin, xGpio * gpio);
227 
241 int iGpioWriteAll (int64_t iMask, bool bValue, xGpio * gpio);
242 
255 int iGpioToggleAll (int64_t iMask, xGpio * gpio);
256 
267 int iGpioRead (int iPin, xGpio * gpio);
268 
283 int64_t iGpioReadAll (int64_t iMask, xGpio * gpio);
284 
295 int iGpioSetReleaseOnClose (bool enable, xGpio * gpio);
296 
306 bool bGpioGetReleaseOnClose (const xGpio * gpio);
307 
320 int iGpioRelease (int iPin, xGpio * gpio);
321 
322 
328 bool bGpioHasNext (const xGpio * gpio);
329 
335 bool bGpioHasPrevious (const xGpio * gpio);
336 
342 int iGpioNext (xGpio * gpio);
343 
349 int iGpioPrevious (xGpio * gpio);
350 
356 int iGpioToBack (xGpio * gpio);
357 
363 int iGpioToFront (xGpio * gpio);
364 
370 const char * sGpioModeToStr (eGpioMode eMode);
371 
375 #ifdef __cplusplus
376 }
377 #endif
378 #endif // __DOXYGEN__
379 /* ========================================================================== */
380 #endif /*_SYSIO_GPIO_C_H_ defined */