[STM8] 谁能详细说明一下GPIO管脚类型(上拉,悬浮...)怎样使用的

[复制链接]
1523|3
 楼主| Rthena 发表于 2015-10-23 22:02 | 显示全部楼层 |阅读模式
typedef enum
{
  GPIO_Mode_In_FL_No_IT      = (uint8_t)0x00,   /*!< Input floating, no external interrupt */
  GPIO_Mode_In_PU_No_IT      = (uint8_t)0x40,   /*!< Input pull-up, no external interrupt */
  GPIO_Mode_In_FL_IT         = (uint8_t)0x20,   /*!< Input floating, external interrupt */
  GPIO_Mode_In_PU_IT         = (uint8_t)0x60,   /*!< Input pull-up, external interrupt */
  GPIO_Mode_Out_OD_Low_Fast  = (uint8_t)0xA0,   /*!< Output open-drain, low level, 10MHz */
  GPIO_Mode_Out_PP_Low_Fast  = (uint8_t)0xE0,   /*!< Output push-pull, low level, 10MHz */
  GPIO_Mode_Out_OD_Low_Slow  = (uint8_t)0x80,   /*!< Output open-drain, low level, 2MHz */
  GPIO_Mode_Out_PP_Low_Slow  = (uint8_t)0xC0,   /*!< Output push-pull, low level, 2MHz */
  GPIO_Mode_Out_OD_HiZ_Fast  = (uint8_t)0xB0,   /*!< Output open-drain, high-impedance level, 10MHz */
  GPIO_Mode_Out_PP_High_Fast = (uint8_t)0xF0,   /*!< Output push-pull, high level, 10MHz */
  GPIO_Mode_Out_OD_HiZ_Slow  = (uint8_t)0x90,   /*!< Output open-drain, high-impedance level, 2MHz */
  GPIO_Mode_Out_PP_High_Slow = (uint8_t)0xD0    /*!< Output push-pull, high level, 2MHz */
}GPIO_Mode_TypeDef;
天灵灵地灵灵 发表于 2015-10-23 22:09 | 显示全部楼层
就看后面的注释啊。第一个,输入浮点,没有外部中断。第二个输入上拉电阻配置,无外部中断。
豆腐块 发表于 2015-10-25 21:27 | 显示全部楼层
拉克丝 发表于 2015-10-28 22:10 | 显示全部楼层
GPIO基本设置
GPIOMode_TypeDef GPIO mode定义及偏移地址
GPIO_Mode_AIN = 0x0,     //模拟输入  
GPIO_Mode_IN_FLOATING = 0x04, //悬空输入   
GPIO_Mode_IPD = 0x28,    //下拉输入   
GPIO_Mode_IPU = 0x48,    //上拉输入   
GPIO_Mode_Out_OD = 0x14, //开漏输出  
GPIO_Mode_Out_PP = 0x10,  //推挽输出   
GPIO_Mode_AF_OD = 0x1C,   //开漏复用   
GPIO_Mode_AF_PP = 0x18    //推挽复用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

4

主题

11

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部