one shot timer

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

is the one shot timer function (CyU3PTimerCreate with RescheduleTicks=0) already implemented?

   

I can not get it working.

   

Best regards

   

g.

0 Likes
2 Replies
Anonymous
Not applicable

Are you seeing any error being returned or does the API succeed but without the expected output?

   

Please post the code that you're using as well I would like to look at the parameters you're using.

   

Regards,

   

Anand

0 Likes
Anonymous
Not applicable

Hello,

   

i tried it like follows:

   

CyU3PTimer pTimer1;   // global

   

Initialisation:

   

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
    uint32_t nExpirationInput=0;
    uint32_t nInitialTicks = 10;
    uint32_t nRescheduleTicks = 0;       // If set to zero, the timer will be a one-shot timer
    uint32_t nTimerOption = CYU3P_NO_ACTIVATE;
    status = CyU3PTimerCreate(&pTimer1,TimerFunc1,nExpirationInput,nInitialTicks,nRescheduleTicks,nTimerOption);
    if (status != CY_U3P_SUCCESS){
            CyU3PDebugPrint (4, "CyU3PTimerCreate Failed, Error Code = %x\r\n",status);
        }
 

   

Start of one shot timer:

   

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

   

    status = CyU3PTimerStart(&pTimer1);    //re-start one-shot timer
    if (status != CY_U3P_SUCCESS)
        CyU3PDebugPrint (4, "CyU3PTimerStart Failed, Error Code = %x\r\n",status);
 

   

    CyU3PTimerStart gives me the error : CY_U3P_ERROR_ACTIVATE_FAILED

   

 

   

Best regards

   

g.

0 Likes