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

[讨论] 关于DRV_TOOL配置GPIO

[复制链接]
发表于 2010-9-25 11:58:24 | 显示全部楼层 |阅读模式
不知道大家用DRV_TOOL配置GPIO口的时候用的是什么方法,我们都只是在以前项目的基础上根据原理图相应的改一下,但对于很多都不知道为什么,比如什么时候上拉?什么时候下拉?为什么有些gpio口输入输出都不选?做out时,什么时候又该OutHigh ??还有,我看了一下生成的GPIO_DRV.H,里面只定义了端口,但并没有把这些定义写入CPU的相应寄存器,我又找了一下,也看不到将这些定义写寄存器的地方?
哪位朋友帮解答一下,不甚感激~~[em11]
发表于 2010-9-27 09:01:05 | 显示全部楼层
请LZ注意以下的代码

/* General macro to calculate GPIO MODE register. */
#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))

/* General macro to calculate GPO MODE register. */
#define GPO_MODE_REG_VAL(port0, port1, port2, port3, port4, port5, port6, port7)                     ((GPO_PORT##port0##_MODE) | (GPO_PORT##port1##_MODE<<2) | (GPO_PORT##port2##_MODE<<4) |        (GPO_PORT##port3##_MODE<<6) | (GPO_PORT##port4##_MODE<<8) | (GPO_PORT##port5##_MODE<<10) |     (GPO_PORT##port6##_MODE<<12) | (GPO_PORT##port7##_MODE<<14))

/* General macro to calculate GPIO register with 1 bit unit. */
#define GPIO_HWORD_REG_FOR_1BIT(name, port0, port1, port2, port3, port4, port5, port6, port7, port8, port9,                                 port10, port11, port12, port13, port14, port15)            ((GPIO_PORT##port0##_##name) | (GPIO_PORT##port1##_##name<<1) | (GPIO_PORT##port2##_##name<<2) |             (GPIO_PORT##port3##_##name<<3) | (GPIO_PORT##port4##_##name<<4) | (GPIO_PORT##port5##_##name<<5) |           (GPIO_PORT##port6##_##name<<6) | (GPIO_PORT##port7##_##name<<7) | (GPIO_PORT##port8##_##name<<8) |           (GPIO_PORT##port9##_##name<<9) | (GPIO_PORT##port10##_##name<<10) | (GPIO_PORT##port11##_##name<<11) |       (GPIO_PORT##port12##_##name<<12) | (GPIO_PORT##port13##_##name<<13) | (GPIO_PORT##port14##_##name<<14) |     (GPIO_PORT##port15##_##name<<15))
点评回复

使用道具 举报

发表于 2010-9-26 19:59:00 | 显示全部楼层
GPIO_setting_init()
点评回复

使用道具 举报

 楼主| 发表于 2010-9-25 15:20:04 | 显示全部楼层
路过的说句话把~......[em13]
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

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

GMT+8, 2025-2-26 22:24 , Processed in 0.081284 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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