Ejemplo n.º 1
0
// =============================================================================
// 功能:CRTCH芯片初始化,包括WP写保护功能引脚初始化和加载设备到对应的IIC总线
// 参数:无
// 返回:true,成功;false,失败
// =============================================================================
bool_t CRT_Init(void)
{

	static struct tagIIC_Device s_CRT_Dev;

	//初始化IIC设备结构体
	s_CRT_Dev.DevAddr 					= CRT_ADDRESS;
	s_CRT_Dev.BitOfMemAddr 				= 8;
	s_CRT_Dev.BitOfMemAddrInDevAddr 	= 0;

	//添加CRTCH到IIC0总线
	if(NULL != IIC_DevAdd_s("IIC0","IIC_Dev_CRTCH",&s_CRT_Dev))
	{
		ps_CRT_Dev = &s_CRT_Dev;
		IIC_BusCtrl(ps_CRT_Dev,CN_IIC_SET_CLK,CRT_CLK_FRE,0);
		IIC_BusCtrl(ps_CRT_Dev,CN_IIC_SET_POLL,0,0);
		return true;
	}

	return false;
}
Ejemplo n.º 2
0
ptu32_t MMA8541Q_ModuleInit(ptu32_t para)
{
    bool_t result = false;
    static struct IIC_Device s_MMA_Dev;
    //GPIO初始化,SDA、SCL已经在IIC中初始化了,此处只需初始化WP即可
//  __MMA_GpioInit();

    //初始化IIC设备结构体
    s_MMA_Dev.DevAddr                   = MMA_ADDRESS;
    s_MMA_Dev.BitOfMemAddr              = 8;
    s_MMA_Dev.BitOfMemAddrInDevAddr     = 0;

    //添加MMA8451到IIC0总线
    if(NULL != IIC_DevAdd_r("IIC0","IIC_Dev_MMA8451Q",&s_MMA_Dev))
    {
        ps_MMA_Dev = &s_MMA_Dev;
        IIC_BusCtrl(ps_MMA_Dev,CN_IIC_SET_CLK,MMA_CLK_FRE,0);
        result = true;
    }

    return result;
}