GUI_TIMER_Create

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • GUI_TIMER_Create

      Hi,

      I'm creating an access code window.
      When entering the correct code, I start a timer which will go off after 60 seconds when no key press was done so the logged in user is logged out again.


      when entering the code I create following timer:

      C Source Code

      1. GUI_TIMER_HANDLE logged_in_timer = GUI_TIMER_Create(CheckAccessRightsTimer, 60000, 0, 0);


      Sometimes it works fine the first time. The timer goes off and is logging me out.
      When I try to log in a second time, I'm directly routed to my callback function.. It does not wait the 60 seconds

      C Source Code

      1. static void CheckAccessRightsTimer(GUI_TIMER_MESSAGE * pTM)
      2. {
      3. admin_mode = LOGGED_OUT;
      4. }

      I've read the manual but not much information can be found of such timers.

      Any help in this?

      Thanks!
    • ok have new results ...

      What I did on second log in, I've deleted the timer and re-inited it again.
      this was not working properly in the second time I try to use that timer..

      I now init it once, set the time period and just use the restart when I need that timer again and this seems to work just fine.

      But my issue remains, still strange when deleting a timer and re-init it again, that this is not working?
    • Hi Pieter,

      you have to set a period for the timer using GUI_TIMER_SetPeriod(). Once you did so, calling GUI_TIMER_Restart() will restart that timer with the set period.
      By the way, when using windows, you might want to use the timer API that is part of the Window Manager (WM_CreateTimer() etc...) for convenience reasons. When a timer of a window has run out, that window will receive a WM_TIMER message that you can handle in your callback. But you may use GUI_TIMERs instead if you want to do so.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      I have different windows (multiple pages system) so using a window timer is no option for me.
      It works now because I defined the time before the main loop once.
      When I than restart the timer this is working.

      The case that was not working is deleting a timer variable and re-init it afterwards again.
      This seems an EmWin related issue?
    • Hi Pieter,

      window timers still do its job when you use multiple windows. You can create and react on timers with different windows, you just need the window handle the timer will be attached to.
      What applies for both kinds of timers, is that you still need the correct timer handle when you want to delete or restart a timer.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.