ISSDK  1.8
IoT Sensing Software Development Kit
gpio_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /**
9  * @file gpio_driver.h
10  * @brief The gpio_driver.h file containes the Generic Irq implmentation for the i.MXRT1050 gpio.
11 */
12 
13 #ifndef __DRIVER_GPIO_H__
14 #define __DRIVER_GPIO_H__
15 
16 #include "Driver_Common.h"
17 #include "Driver_GPIO.h"
18 #include "fsl_common.h"
19 #include "fsl_gpio.h"
20 
21 #define PIN_SET 1U
22 #define PIN_CLR 0U
23 
24 /**
25 \brief GPIO PORT NAMES.
26 */
27 typedef enum port_number
28 {
29  GPIO1_NUM = 0,
30  GPIO2_NUM = 1,
31  GPIO3_NUM = 2,
32  GPIO4_NUM = 3,
33  GPIO5_NUM = 4,
36 
37 /*!
38  * @brief The GPIO Pin Configuration i.MX SDK.
39  */
40 typedef struct gpioConfigiMXSDK
41 {
42  gpio_pin_config_t pinConfig; /*!< General pin charactertics.*/
43  gpio_interrupt_mode_t interruptMode; /*!< Interrupt mode for a pin.*/
45 
46 /*!
47  * @brief The GPIO pin handle for i.MX SDK.
48  */
49 typedef struct gpioHandleiMXSDK
50 {
51  GPIO_Type *base; /*!< Base address of the GPIO Port.*/
52  uint32_t pinNumber; /*!< pin number start from 0 -31.*/
53  uint32_t mask; /*!< mask value for a pin.*/
54  IRQn_Type irq; /*!< IRQ Number for the port.*/
55  port_number_t portNumber; /*!< Port Number for the port.*/
56  uint8_t pinStatus; /*!< pin status.*/
58 
59 /*!
60  * @brief The gpio isr object.
61  */
62 typedef struct gpioIsrObj
63 {
64  void *pUserData; /*!< Pointer to a UserData.*/
65  gpio_isr_handler_t isrHandle; /*!< pointer to isrHandle.*/
66 } gpioIsrObj_t;
67 
68 /*!
69  * @brief Macro to create a Gpio handle
70  */
71 #define MAKE_GPIO_HANDLE(Base, PinNumber, Irq) \
72  static gpioHandleKSDK_t PortName##PinNumber = {.base = Base, \
73  .pinNumber = PinNumber, \
74  .irq = Irq};
76 
77 #endif // __DRIVER_GPIO_H__
struct gpioIsrObj gpioIsrObj_t
The gpio isr object.
The GPIO Pin Configuration i.MX SDK.
Definition: gpio_driver.h:40
port_number
GPIO PORT NAMES.
Definition: gpio_driver.h:27
gpio_pin_config_t pinConfig
Definition: gpio_driver.h:42
The gpio isr object.
Definition: gpio_driver.h:62
void(* gpio_isr_handler_t)(void *apUserData)
Definition: Driver_GPIO.h:34
Access structure of the GPIO Driver.
Definition: Driver_GPIO.h:38
void * pUserData
Definition: gpio_driver.h:64
The Driver_GPIO.h file contains the definitions for GPIO Driver direction.
IRQn_Type irq
Definition: gpio_driver.h:54
gpio_interrupt_mode_t interruptMode
Definition: gpio_driver.h:43
gpio_isr_handler_t isrHandle
Definition: gpio_driver.h:65
port_number_t portNumber
Definition: gpio_driver.h:55
uint32_t pinNumber
Definition: gpio_driver.h:52
struct gpioConfigiMXSDK gpioConfigiMXSDK_t
The GPIO Pin Configuration i.MX SDK.
struct gpioHandleiMXSDK gpioHandleiMXSDK_t
The GPIO pin handle for i.MX SDK.
enum port_number port_number_t
GPIO PORT NAMES.
The GPIO pin handle for i.MX SDK.
Definition: gpio_driver.h:49
GPIO_Type * base
Definition: gpio_driver.h:51
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:177
uint8_t pinStatus
Definition: gpio_driver.h:56