This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Configure ClockFxn to run certain number of times

Other Parts Discussed in Thread: CC2650

Hello,

What is the best way to stop clock objects using Clock.h from running their clockFunctions after x amount of times? The first thing that comes to mind is setting a counter variable and checking it every single time the clockFunction runs with a certain period, issuing some kind of stop function when that count==0. Would there happen to be a better way to do so? I don't think I'm seeing an inherent count field in the clockParams.

I'm using a CC2650 on a custom PCB if that makes a difference.

Thanks,

Michael

  • Hi Michael,

    The clock module can only be set as one-shot or repetive mode. Therefore, you would have to keep a count and stop it when you are done.

    Two ways of doing this:

    1. Using repetitive clock. Start your clock once and count every time you enter the clock callback function. Once you reach your count, use Clock_stop(...)
    2. Using one-shot clock. Start your clock every time you enter the clock callback function. Don't start it when you reach your desired count.

    Regards,

    Michel

  • There was a suggested answer and since there has been no active on this thread for more than a week, the suggested answer was marked as verify. Please feel free to select the "Reject Answer" button and reply with more details.