1 /* mbed Microcontroller Library
2  *******************************************************************************
3  * Copyright (c) 2015, Realtek Semiconductor Corp.
4  * All rights reserved.
5  *
6  * This module is a confidential and proprietary property of RealTek and
7  * possession or use of this module requires written permission of RealTek.
8  *******************************************************************************
9  */
10 
11 #ifndef MBED_GPIO_IRQ_EX_API_H
12 #define MBED_GPIO_IRQ_EX_API_H
13 
14 #include "device.h"
15 
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /** @addtogroup gpio_irq_ex_api GPIO_IRQ_EX
22  *  @ingroup    hal
23  *  @brief      gpio IRQ extented functions
24  *  @{
25  */
26 
27 ///@name Ameba Common
28 ///@{
29 typedef enum {
30     IRQ_LOW = 3,
31     IRQ_HIGH = 4,
32     IRQ_FALL_RISE = 5   // dual edge trigger, available for 8195B only
33 } gpio_irq_event_ex;
34 
35 /**
36   * @brief  Deinitializes the GPIO device interrupt mode, include mode/trigger/polarity registers.
37   * @param  obj: gpio irq object define in application software.
38   * @retval none
39   */
40 void gpio_irq_deinit(gpio_irq_t *obj);
41 
42 /**
43   * @brief  Sets pull type to the selected interrupt pin.
44   * @param  obj: gpio irq object define in application software.
45   * @param  pull_type: this parameter can be one of the following values:
46   *		@arg PullNone: HighZ, user can input high or low use this pin
47   *		@arg OpenDrain(is OpenDrain output): no pull + OUT + GPIO[gpio_bit] = 0
48   *		@arg PullDown: pull down
49   *		@arg PullUp: pull up
50   * @retval none
51   */
52 void gpio_irq_pull_ctrl(gpio_irq_t *obj, PinMode pull_type);
53 ///@}
54 
55 #if (defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1))  ||  (defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1))
56 ///@name AmebaPro Only
57 ///@{
58 /**
59  *  @brief To enables or disable the debounce function of the given GPIO IRQ pin.
60  *         The debounce resource(circuit) is limited, not all GPIO pin
61  *         can has debounce function.
62  *
63  *  @param[in]  pgpio_irq_adapter  The GPIO IRQ pin adapter.
64  *  @param[in]  debounce_us  The time filter for the debounce, in micro-second.
65  *                           But the time resolution is 31.25us (1/32K) and the
66  *                           maximum time is 512 ms.
67  * @param[in]  enable: this parameter can be one of the following values:
68  *     @arg 0 disable gpio debounce interrupt
69  *     @arg 1 enable gpio debounce interrupt
70  *  @return     0:  Setting Succeed.
71  *  @return     -1:  Setting Fail.
72  */
73 int gpio_irq_debounce_set (gpio_irq_t *obj, uint32_t debounce_us, u8 enable);
74 ///@}
75 #endif //CONFIG_PLATFORM_8195BHP || CONFIG_PLATFORM_8195BLP
76 
77 
78 /*\@}*/
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif  // end of #ifndef MBED_GPIO_IRQ_EX_API_H