emios in GPIO output mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

emios in GPIO output mode

跳至解决方案
2,534 次查看
WeiC
Contributor I

How to use the GPIO mode of emios to output high or low levels of the PTA24 pin on the S32K312 chip

0 项奖励
回复
1 解答
2,520 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@wc

you can take a look at the function:

/*FUNCTION**********************************************************************
*
* Function Name : Emios_Pwm_Ip_SetOutputState
* Description   : Set the state of output pin
*
*
*END**************************************************************************/
void Emios_Pwm_Ip_SetOutputState(uint8 Instance,
                                 uint8 Channel,
                                 Emios_Pwm_Ip_OutputStateType OutputState)
{
#if (EMIOS_PWM_IP_DEV_ERROR_DETECT == STD_ON)
    DevAssert(EMIOS_PWM_IP_INSTANCE_COUNT > Instance);
    DevAssert(EMIOS_PWM_IP_CHANNEL_COUNT > Channel);
#endif
    Emios_Pwm_Ip_HwAddrType *const Base = Emios_Pwm_Ip_aBasePtr[Instance];
    SchM_Enter_Pwm_PWM_EXCLUSIVE_AREA_24();
    /* Set output pin polarity */
    if (EMIOS_PWM_IP_OUTPUT_STATE_LOW == OutputState)
    {
        Emios_Pwm_Ip_SetEdgePolarity(Base, Channel, (Emios_Pwm_Ip_PolarityType)EMIOS_PWM_IP_ACTIVE_LOW);
    }
    else
    {
        Emios_Pwm_Ip_SetEdgePolarity(Base, Channel, (Emios_Pwm_Ip_PolarityType)EMIOS_PWM_IP_ACTIVE_HIGH);
    }
    /* Enter GPIO output Mode */
    Emios_Pwm_Ip_SetPwmMode(Base, Channel, (Emios_Pwm_Ip_PwmModeType)EMIOS_PWM_IP_MODE_GPO);
    /* Stored the current Mode */
    Emios_Pwm_Ip_aCurrentModes[Instance][Channel] = (Emios_Pwm_Ip_PwmModeType)EMIOS_PWM_IP_MODE_GPO;
    /* Disable Channel interrupts */
    Emios_Pwm_Ip_SetInterruptRequest(Base, Channel, FALSE);
    /* Clear pending interrupt flag for the Channel */
    Emios_Pwm_Ip_ClearFlagEvent(Base, Channel);
    /* Confirm the Channel is idle state */
    Emios_Pwm_Ip_aCheckState[Instance][Channel] = (uint8)2U;
    SchM_Exit_Pwm_PWM_EXCLUSIVE_AREA_24();
}


for example:

Emios_Pwm_Ip_SetOutputState(INSTANCE_1,7,EMIOS_PWM_IP_OUTPUT_STATE_LOW);
TestDelay(0x1fff);
Emios_Pwm_Ip_SetOutputState(INSTANCE_1,7,EMIOS_PWM_IP_OUTPUT_STATE_HIGH);
TestDelay(0x1fff);

 

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
2,521 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@wc

you can take a look at the function:

/*FUNCTION**********************************************************************
*
* Function Name : Emios_Pwm_Ip_SetOutputState
* Description   : Set the state of output pin
*
*
*END**************************************************************************/
void Emios_Pwm_Ip_SetOutputState(uint8 Instance,
                                 uint8 Channel,
                                 Emios_Pwm_Ip_OutputStateType OutputState)
{
#if (EMIOS_PWM_IP_DEV_ERROR_DETECT == STD_ON)
    DevAssert(EMIOS_PWM_IP_INSTANCE_COUNT > Instance);
    DevAssert(EMIOS_PWM_IP_CHANNEL_COUNT > Channel);
#endif
    Emios_Pwm_Ip_HwAddrType *const Base = Emios_Pwm_Ip_aBasePtr[Instance];
    SchM_Enter_Pwm_PWM_EXCLUSIVE_AREA_24();
    /* Set output pin polarity */
    if (EMIOS_PWM_IP_OUTPUT_STATE_LOW == OutputState)
    {
        Emios_Pwm_Ip_SetEdgePolarity(Base, Channel, (Emios_Pwm_Ip_PolarityType)EMIOS_PWM_IP_ACTIVE_LOW);
    }
    else
    {
        Emios_Pwm_Ip_SetEdgePolarity(Base, Channel, (Emios_Pwm_Ip_PolarityType)EMIOS_PWM_IP_ACTIVE_HIGH);
    }
    /* Enter GPIO output Mode */
    Emios_Pwm_Ip_SetPwmMode(Base, Channel, (Emios_Pwm_Ip_PwmModeType)EMIOS_PWM_IP_MODE_GPO);
    /* Stored the current Mode */
    Emios_Pwm_Ip_aCurrentModes[Instance][Channel] = (Emios_Pwm_Ip_PwmModeType)EMIOS_PWM_IP_MODE_GPO;
    /* Disable Channel interrupts */
    Emios_Pwm_Ip_SetInterruptRequest(Base, Channel, FALSE);
    /* Clear pending interrupt flag for the Channel */
    Emios_Pwm_Ip_ClearFlagEvent(Base, Channel);
    /* Confirm the Channel is idle state */
    Emios_Pwm_Ip_aCheckState[Instance][Channel] = (uint8)2U;
    SchM_Exit_Pwm_PWM_EXCLUSIVE_AREA_24();
}


for example:

Emios_Pwm_Ip_SetOutputState(INSTANCE_1,7,EMIOS_PWM_IP_OUTPUT_STATE_LOW);
TestDelay(0x1fff);
Emios_Pwm_Ip_SetOutputState(INSTANCE_1,7,EMIOS_PWM_IP_OUTPUT_STATE_HIGH);
TestDelay(0x1fff);

 

 

0 项奖励
回复
2,515 次查看
WeiC
Contributor I

Thank you very much!

0 项奖励
回复