/* * Copyright (c) 2022 OpenLuat & AirM2M * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef LUAT_GPIO_H #define LUAT_GPIO_H #include "luat_base.h" #include "luat_gpio_legacy.h" /** * @defgroup luatos_device 外设接口 * @{ */ /** * @defgroup luatos_device_gpio GPIO接口 * @{ */ #define LUAT_GPIO_LOW (Luat_GPIO_LOW) ///< GPIO配置为低电平 #define LUAT_GPIO_HIGH (Luat_GPIO_HIGH) ///< GPIO配置为高电平 #define LUAT_GPIO_OUTPUT (Luat_GPIO_OUTPUT) ///< GPIO配置为输出模式 #define LUAT_GPIO_INPUT (Luat_GPIO_INPUT) ///< GPIO配置为输入模式 #define LUAT_GPIO_IRQ (Luat_GPIO_IRQ) ///< GPIO配置为中断模式 #define LUAT_GPIO_DEFAULT (Luat_GPIO_DEFAULT) ///< GPIO配置为默认模式,EC618平台,普通的GPIO配置为LUAT_GPIO_DEFAULT,表示完全关闭上下拉;AGPIO软件上不支持配置上下拉,即使配置了也无效,一直是硬件开机或者复位时的默认状态 #define LUAT_GPIO_PULLUP (Luat_GPIO_PULLUP) ///< GPIO配置为上拉模式 #define LUAT_GPIO_PULLDOWN (Luat_GPIO_PULLDOWN)///< GPIO配置为下拉模式 #define LUAT_GPIO_RISING_IRQ (Luat_GPIO_RISING) ///<上升沿中断 #define LUAT_GPIO_FALLING_IRQ (Luat_GPIO_FALLING)///< 下降沿中断 #define LUAT_GPIO_BOTH_IRQ (Luat_GPIO_BOTH) ///< 上升沿 下降沿都中断 #define LUAT_GPIO_HIGH_IRQ (Luat_GPIO_HIGH_IRQ) ///< GPIO配置为高电平中断模式 #define LUAT_GPIO_LOW_IRQ (Luat_GPIO_LOW_IRQ) ///< GPIO配置为低电平模式 #define LUAT_GPIO_NO_IRQ (0xff) ///< GPIO没有中断模式 #define LUAT_GPIO_MAX_ID (Luat_GPIO_MAX_ID) ///< 最大GPIO序号 /** * @brief GPIO控制参数 */ typedef struct luat_gpio_cfg { int pin; /**<引脚*/ uint8_t mode;/**