M451的GPIO可以设置成脉冲上升沿或下降沿中断吗?

2019-07-15 07:33发布

M451的GPIO可以设置成脉冲上升沿或下降沿中断吗?如果识别是哪个中断源呢?有例程吗?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
5条回答
广州洋钒
1楼-- · 2019-07-15 13:29
  1. /**
  2. * [url=home.php?mod=space&uid=247401]@brief[/url]       Enable GPIO interrupt
  3. *
  4. * @param[in]   port            GPIO port. It could be PA, PB, PC, PD, PE or PF.
  5. * @param[in]   u32Pin          The pin of specified GPIO port.
  6. *                              It could be 0 ~ 15 for PA, PB, PC and PD GPIO port.
  7. *                              It could be 0 ~ 14 for PE GPIO port.
  8. *                              It could be 0 ~ 7 for PF GPIO port.
  9. * @param[in]   u32IntAttribs   The interrupt attribute of specified GPIO pin. It could be
  10. *                              GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.
  11. *
  12. * [url=home.php?mod=space&uid=266161]@return[/url]      None
  13. *
  14. * [url=home.php?mod=space&uid=1543424]@Details[/url]     This function is used to enable specified GPIO pin interrupt.
  15. */
  16. void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
  17. {
  18.     port->INTTYPE |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
  19.     port->INTEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
  20. }
复制代码
皮皮鲁鲁鲁皮
2楼-- · 2019-07-15 17:16
GPIO_INT_BOTH_EDGE

采用双边沿。
wuli北
3楼-- · 2019-07-15 17:20
 精彩回答 2  元偷偷看……
Green_LJ
4楼-- · 2019-07-15 17:38
试试上面的,或者最好示波器观察一下。如果是脉冲,宽度可以忽略的,你上升沿跟下降沿不就是同时了吗
就好国dd
5楼-- · 2019-07-15 21:06
双边沿模式嘛

一周热门 更多>