[技术问答] M0518设置IO中断的库函数是不是有问题?

[复制链接]
1508|8
 楼主| 21icszx 发表于 2016-7-24 20:35 | 显示全部楼层 |阅读模式
M0518设置IO中断的库函数是不是有问题?
/**
* @brief       Enable GPIO interrupt
*
* @param[in]   port            GPIO port. It could be PA, PB, PC, PD, PE or PF.
* @param[in]   u32Pin          The pin of specified GPIO port.
*                              It could be 0 ~ 15 for PA and PB GPIO port.
*                              It could be 0 ~ 3, 6 ~ 11, BIT14 and BIT15 for PC GPIO port.
*                              It could be 6, 7, 14 and BIT15 for PD GPIO port.
*                              It could be 5 for PE GPIO port.
*                              It could be 0, 1 and 4 ~ 8 for PF GPIO port.
* @param[in]   u32IntAttribs   The interrupt attribute of specified GPIO pin. It could be \n
*                              GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.
*
* @return      None
*
* @Details     This function is used to enable specified GPIO pin interrupt.
*/
void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
{
    port->IMD |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
    port->IEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
}


设置PC的9/10/11脚上升沿中断:
GPIO_EnableInt(PC, BIT11 | BIT10 | BIT9, GPIO_INT_RISING);
玛尼玛尼哄 发表于 2016-7-24 21:42 | 显示全部楼层
没有看过原型,楼主如果觉得有问题,可以去官方下载最新版本,看看有没有更改。
zhuotuzi 发表于 2016-7-24 22:28 | 显示全部楼层
这个功能是常用的功能,应该不会有问题。
 楼主| 21icszx 发表于 2016-7-25 08:52 | 显示全部楼层
dwh000 发表于 2016-7-25 08:47
你用的不对,仔细看看函数说明,看看新唐提供的例程如何使用的.

认真看了下函数原型,确实是使用方法有问题,引脚参数有问题,而且必须每个脚单独开中断,谢谢
 楼主| 21icszx 发表于 2016-7-25 08:53 | 显示全部楼层
capturesthe 发表于 2016-7-25 14:37 | 显示全部楼层
这有几个中断源?
huangcunxiake 发表于 2016-7-26 11:17 | 显示全部楼层
配置的不正确肯定是不对的。人家没问题。
zhuomuniao110 发表于 2016-7-26 23:43 | 显示全部楼层
搞定就好,下次就高手了。
heisexingqisi 发表于 2016-7-27 07:18 | 显示全部楼层
最好下载个BSP包,里面有例程,讲解的很清楚,都有注释,比STM32做的还好
您需要登录后才可以回帖 登录 | 注册

本版积分规则

16

主题

157

帖子

1

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