ISSDK  1.8
IoT Sensing Software Development Kit
gpio_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 /**
10  * @file gpio_driver.h
11  * @brief The gpio_driver.h file containes the Generic Irq implmentation for the gpio.
12  * The type and variable names have been kept aligned to Kinetis family for compatibility of examples.
13 */
14 
15 #ifndef __DRIVER_GPIO_H__
16 #define __DRIVER_GPIO_H__
17 
18 #include "Driver_Common.h"
19 #include "Driver_GPIO.h"
20 #include "fsl_common.h"
21 #include "fsl_gpio.h"
22 #include "fsl_gint.h"
23 
24 typedef enum _gint_interrupt
25 {
26  kGINT_InterruptLogic_0 = 0x0U, /*!< Interrupt on Logic 0 (Falling Edge or Level Low). */
27  kGINT_InterruptLogic_1 = 0x1U, /*!< Interrupt on Logic 1 (Rising Edge or Level High). */
29 
30 /*!
31  * @brief The GPIO Configuration KSDK.
32  */
33 typedef struct gpioConfigKSDK
34 {
35  gpio_pin_config_t pinConfig; /*!< General pin charactertics.*/
36  gint_trig_t interruptMode; /*!< Interrupt mode for a pin.*/
37  gint_interrupt_t interruptPolarity; /*!< Interrupt Polarity 0/1 for a pin.*/
39 
40 /*!
41  * @brief The GPIO pin handle for KSDK.
42  */
43 typedef struct gpioHandleKSDK
44 {
45  GPIO_Type *base; /*!< Base address of the GPIO Port.*/
46  uint32_t pinNumber; /*!< pin number start from 0 -31.*/
47  uint32_t mask; /*!< mask value for a pin.*/
48  clock_ip_name_t clockName; /*!< Clock Name for the port.*/
49  gint_port_t portNumber; /*!< Port Number for the port.*/
51 
52 /*!
53  * @brief The gpio isr object.
54  */
55 typedef struct gpioIsrObj
56 {
57  void *pUserData; /*!< Pointer to a UserData.*/
58  gpio_isr_handler_t isrHandle; /*!< pointer to isrHandle.*/
59 } gpioIsrObj_t;
60 
61 /*!
62  * @brief Macro to create a Gpio handle
63  */
64 #define MAKE_GPIO_HANDLE(PortName, Base, PinNumber, ClockName, PortNumber) \
65  static gpioHandleKSDK_t PortName##PinNumber = {.base = Base, \
66  .pinNumber = PinNumber, \
67  .mask = 1 << (PinNumber), \
68  .clockName = ClockName, \
69  .portNumber = PortNumber};
70 
71 #define GPIO_PIN_ID(PortName, PinNumber) &(PortName##PinNumber)
73 
74 #endif // __DRIVER_GPIO_H__
struct gpioIsrObj gpioIsrObj_t
The gpio isr object.
The GPIO Configuration KSDK.
Definition: gpio_driver.h:39
struct gpioHandleKSDK gpioHandleKSDK_t
The GPIO pin handle for KSDK.
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
The Driver_GPIO.h file contains the definitions for GPIO Driver direction.
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:49
gpio_pin_config_t pinConfig
Definition: gpio_driver.h:41
gint_trig_t interruptMode
Definition: gpio_driver.h:36
_gint_interrupt
Definition: gpio_driver.h:24
gint_port_t portNumber
Definition: gpio_driver.h:49
enum _gint_interrupt gint_interrupt_t
struct gpioConfigKSDK gpioConfigKSDK_t
The GPIO Configuration KSDK.
gint_interrupt_t interruptPolarity
Definition: gpio_driver.h:37
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:177