找回密码
 注册
搜索
查看: 889|回复: 3

[讨论] 各位大吓!! 这段语句怎么理解啊!!!

[复制链接]
发表于 2007-9-13 09:29:57 | 显示全部楼层 |阅读模式
#define GPIO_MODE_REG_VAL(port0, port1, port2, port3, port4, port5, port6, port7)                     ((GPIO_PORT##port0##_MODE) | (GPIO_PORT##port1##_MODE<<2) | (GPIO_PORT##port2##_MODE<<4) |        (GPIO_PORT##port3##_MODE<<6) | (GPIO_PORT##port4##_MODE<<8) | (GPIO_PORT##port5##_MODE<<10) |     (GPIO_PORT##port6##_MODE<<12) | (GPIO_PORT##port7##_MODE<<14))

特别是中间的##怎么理解!!

谢谢各位大吓了!!!!
发表于 2007-9-13 14:21:12 | 显示全部楼层
联合符号(不知道是不是这么翻译)
就是把不同的宏串联成一个,比如
GPIO_PORT##port1##_MODE,
当port1为1时,宏处理完就是GPIO_PORT1_MODE
不知道我说的你明白没?
点评回复

使用道具 举报

 楼主| 发表于 2007-9-13 18:42:35 | 显示全部楼层
非常感谢哈!!!
点评回复

使用道具 举报

发表于 2010-6-22 16:41:56 | 显示全部楼层
以下是引用x7730在2007-9-13 14:21:12的发言:
联合符号(不知道是不是这么翻译)
就是把不同的宏串联成一个,比如
GPIO_PORT##port1##_MODE,
当port1为1时,宏处理完就是GPIO_PORT1_MODE
不知道我说的你明白没?



GPIO_PORT1_MODE<<2,
那GPIO_PORT1_MODE的具体值是什么,左移2位后又是什么数啊
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-10-6 16:29 , Processed in 0.065601 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表