找回密码
 注册
搜索
查看: 1495|回复: 9

[讨论] GPIO问题!

[复制链接]
发表于 2007-5-10 14:02:47 | 显示全部楼层 |阅读模式
请问:GPIO_InitIO(1, 48);
   GPIO_ModeSetup(48, 0);
   GPIO_WriteIO(1, 48);
是什么意思呀?
发表于 2007-5-10 14:17:16 | 显示全部楼层
就这么几句话,别人也看不出来啊。你还不如问问同事呢
点评回复

使用道具 举报

 楼主| 发表于 2007-5-10 14:43:48 | 显示全部楼层
我全部搞上来大家看看!给我讲讲!xiexie !!
#include "drv_comm.h"
#include "reg_base.h"
#include "gpio_hw.h"
#include "gpio_sw.h"

/*
* FUNCTION                                                            
*        GPIO_init
*
* DESCRIPTION                                                           
*           This function is to initialize the GPIO pins as all GPIO,
*        and configure them as output.
*
* CALLS  
*        None
*
* PARAMETERS
*        None
*       
* RETURNS
*        None
*
* GLOBALS AFFECTED
*   external_global
*/
void GPIO_init(void)
{
   DRV_WriteReg(GPIO_MODE1,0x0000);
   DRV_WriteReg(GPIO_MODE2,0x5005);
   DRV_WriteReg(GPIO_MODE3,0x5100);
   DRV_WriteReg(GPIO_MODE4,0x0554);
   DRV_WriteReg(GPIO_MODE5,0x0225);
   DRV_WriteReg(GPIO_MODE6,0x5540);
   DRV_WriteReg(GPIO_MODE7,0x0055);
   DRV_WriteReg(GPO_MODE,0x0141);
   
   DRV_Reg(GPIO_DIR1) |= 0xfffe;
   DRV_Reg(GPIO_DIR2) |= 0x80d0;
   DRV_Reg(GPIO_DIR3) |= 0xffff;
   DRV_Reg(GPIO_DIR4) |= 0xf0;

#if 0//++Martin Chen add
   GPIO_InitIO(1, 48);
   GPIO_ModeSetup(48, 0);
   GPIO_WriteIO(1, 48);
#else
#endif   
//--       
#ifdef __USB_ENABLE__
   GPO_WriteIO(0,2);
   //DRV_WriteReg(GPIO_DIR1,0x0010);
#endif        /*__USB_ENABLE__*/

}
点评回复

使用道具 举报

发表于 2007-5-11 11:54:13 | 显示全部楼层
GPIO_InitIO(1, 48);//48口高电平
   GPIO_ModeSetup(48, 0); //模式0
   GPIO_WriteIO(1, 48); //48口高电平

[br]<p align=right><font color=red>+3 RD币</font></p>
点评回复

使用道具 举报

 楼主| 发表于 2007-5-11 12:58:33 | 显示全部楼层
谢谢了,还有后面的呢?没将完呀?
点评回复

使用道具 举报

发表于 2007-5-17 18:14:38 | 显示全部楼层
我来说说吧,GPIO_InitIO(1, 48);        //GPIO48设置为OUTPUT
                  GPIO_ModeSetup(48, 0);//GPIO48设置为I/O功能(GPIO还可以用做他用,所以需要预先配置一下)
                   GPIO_WriteIO(1, 48);     //  GPIO48输出data:1

  参考baseband datasheet

请多指点![br]<p align=right><font color=red>+1 RD币</font></p>
点评回复

使用道具 举报

发表于 2007-5-17 18:21:16 | 显示全部楼层
GPIO_WriteIO(1, 48);     //  GPIO48输出data:1
应该是置1吧?
点评回复

使用道具 举报

发表于 2007-6-1 22:37:29 | 显示全部楼层
GPIO_InitIO(1, 48);
GPIO_ModeSetup(48, 0);
GPIO_WriteIO(1, 48);
关于这3个建议看看平台的register data,无非是讲如何配置及使用GPIO,GPIO模式,GPIO输入输出方向,及GPIO高或者低. 没看过这三个函数,但是你这三个函数有一点不太好,就是参数的顺序,设置mode的于其他相反不知道有什么特殊用处.[em02][br]<p align=right><font color=red>+3 RD币</font></p>
点评回复

使用道具 举报

发表于 2008-2-19 10:31:03 | 显示全部楼层
/*
* FUNCTION                                                            
*        GPIO_InitIO
*
* DESCRIPTION                                                           
*           This function is to initialize one GPIO pin as INPUT or OUTPUT
*
* CALLS  
*        Initialize one GPIO pin as INPUT or OUTPUT
*
* PARAMETERS
*        direction: INPUT or OUTPUT
*        port: pin number
*       
* RETURNS
*        None
*
* GLOBALS AFFECTED
*   external_global
*/




/*
* FUNCTION                                                            
*        GPIO_WriteIO
*
* DESCRIPTION                                                           
*           This function is to write data to one GPIO port
*
* CALLS  
*        Write data to one GPIO port
*
* PARAMETERS
*        data: KAL_TRUE(1) or KAL_FALSE(0)
*        port: gpio pin number
*       
* RETURNS
*        None
*
* GLOBALS AFFECTED
*   external_global        
*/
点评回复

使用道具 举报

发表于 2008-2-19 19:55:27 | 显示全部楼层

我觉得她说得对,应该加分。

<DIV class=quote><B>以下是引用<I>wendy_chen</I>在2007-5-17 18:14:38的发言:</B>
我来说说吧,GPIO_InitIO(1, 48);        //GPIO48设置为OUTPUT
                  GPIO_ModeSetup(48, 0);//GPIO48设置为I/O功能(GPIO还可以用做他用,所以需要预先配置一下)
                   GPIO_WriteIO(1, 48);     //  GPIO48输出data:1

  参考baseband datasheet

请多指点!</DIV>
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

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

GMT+8, 2024-10-5 23:18 , Processed in 0.640821 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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