函数调用问题
时间:10-02
整理:3721RD
点击:
请问下下列函数怎么调用,新手,谢谢了
unsigned short R_TMRD0_Get_PulseWidth(uint32_t * const active_width,
uint32_t * const inactive_width,
tmrd_channel_t channel)
{
MD_STATUS status = MD_OK;
switch (channel)
{
case TMCHANNELA:
if ((TRDIORA0 & _04_TMRD_TRDGRA_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_a;
*inactive_width = g_tmrd0_inactive_width_a;
}
break;
case TMCHANNELB:
if ((TRDIORA0 & _40_TMRD_TRDGRB_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_b;
*inactive_width = g_tmrd0_inactive_width_b;
}
break;
case TMCHANNELC:
if ((TRDIORC0 & _04_TMRD_TRDGRC_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_c;
*inactive_width = g_tmrd0_inactive_width_c;
}
break;
case TMCHANNELD:
if ((TRDIORC0 & _40_TMRD_TRDGRD_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_d;
*inactive_width = g_tmrd0_inactive_width_d;
}
break;
case TMCHANNELELC:
if ((TRDIORC0 & _40_TMRD_TRDGRD_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_elc;
*inactive_width = g_tmrd0_inactive_width_elc;
}
break;
default:
status = MD_ARGERROR;
break;
}
return (status);
}
unsigned short R_TMRD0_Get_PulseWidth(uint32_t * const active_width,
uint32_t * const inactive_width,
tmrd_channel_t channel)
{
MD_STATUS status = MD_OK;
switch (channel)
{
case TMCHANNELA:
if ((TRDIORA0 & _04_TMRD_TRDGRA_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_a;
*inactive_width = g_tmrd0_inactive_width_a;
}
break;
case TMCHANNELB:
if ((TRDIORA0 & _40_TMRD_TRDGRB_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_b;
*inactive_width = g_tmrd0_inactive_width_b;
}
break;
case TMCHANNELC:
if ((TRDIORC0 & _04_TMRD_TRDGRC_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_c;
*inactive_width = g_tmrd0_inactive_width_c;
}
break;
case TMCHANNELD:
if ((TRDIORC0 & _40_TMRD_TRDGRD_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_d;
*inactive_width = g_tmrd0_inactive_width_d;
}
break;
case TMCHANNELELC:
if ((TRDIORC0 & _40_TMRD_TRDGRD_CAPTURE) == 0U)
{
status = MD_ERROR;
}
else
{
*active_width = g_tmrd0_active_width_elc;
*inactive_width = g_tmrd0_inactive_width_elc;
}
break;
default:
status = MD_ARGERROR;
break;
}
return (status);
}
直接将函数赋给一个变量,函数调用时要包含参数,查查C语言的书吧
这么简单的问题,自己检讨
检讨完毕,弄错问题了,是程序上有部分变量没定义。谢谢
谢谢了!
嗯,挺好的,自己找到错误了,不错