完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
使用STM8L101F3P芯片,用iar库函数,想实现最简单的按键中断,在库里有一函数 void EXti_SetHalfPortSelection(EXTI_HalfPort_TypeDef EXTI_HalfPort, FunctionalState NewState) 如图所示, 在使用这个函数的时候,EXTI_HalfPort_TypeDef EXTI_HalfPort可以使用上面提供的组合, 例如EXTI_HalfPort_B_LSB 可是FunctionalState NewState这个应该填什么进去呢,说明没有提供,直接填上十六进制数上去也不行,请教大家一下,谢谢...! 下面贴上直接在库里复制出的原函数 /** * @brief Configure the half port interrupt selection. * @note This function must be called once the port sensitivity is configured, * otherwise this function call won't have any effect on the port external interrupt. * @param EXTI_HalfPort The port part to access (MSB or LSB). * This parameter can be any combination of the following values: * @arg EXTI_HalfPort_B_LSB: Interrupt selector PB(3:0) * @arg EXTI_HalfPort_B_MSB: Interrupt selector PB(7:4) * @arg EXTI_HalfPort_D_LSB: Interrupt selector PE(3:0) * @arg EXTI_HalfPort_D_MSB: Interrupt selector PE(7:4) * @param NewState The external interrupt new state. * @retval None */ void EXTI_SetHalfPortSelection(EXTI_HalfPort_TypeDef EXTI_HalfPort, FunctionalState NewState) { /* Check function parameters */ assert_param(IS_EXTI_HALFPORT(EXTI_HalfPort)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { EXTI->CONF |= (uint8_t)EXTI_HalfPort; /* Enable port interrupt selector */ } else /*NewState == DISABLE */ { EXTI->CONF &= (uint8_t)(~(uint8_t)EXTI_HalfPort); /* Disable port interrupt selector */ } } |
|
相关推荐
3个回答
|
|
|
当前的状态 ENABLE或者DISABLE
|
|
|
|
|
|
functionalstate来自这里:typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;而你仿真可以看一下,此时NewState的值为ENABLE=0X00000001
|
|
|
|
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
265 浏览 0 评论
【原创】【RA4M2-SENSOR开发板评测】低功耗+USB综合测试
789 浏览 0 评论
1306 浏览 2 评论
787 浏览 0 评论
【RA4M2-SENSOR开发板评测】Analogue+Timers综合测试
1587 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
16900 浏览 31 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 00:07 , Processed in 1.090594 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1945