![]() This routine stops a running timer prematurely. Void k_timer_stop ( struct k_timer * timer ) ¶ The timer’s status is reset to zero and the timer begins counting down using the new duration and period values. The timer begins counting down using the specified duration and period values.Īttempting to start a timer that is already running is permitted. This routine starts a timer, and resets its status to zero. Void k_timer_start ( struct k_timer * timer, k_timeout_t duration, k_timeout_t period ) ¶ Stop_fn – Function to invoke if the timer is stopped while running. ParametersĮxpiry_fn – Function to invoke each time the timer expires. This routine initializes a timer, prior to its first use. Returns the timer’s status and resets it to zero.įunctions void k_timer_init ( struct k_timer * timer, k_timer_expiry_t expiry_fn, k_timer_stop_t stop_fn ) ¶ If the timer status is already non-zero or the timer is already stopped ![]() (indicating that it has expired at least once) or the timer is stopped This blocks the thread until the timer’s status is non-zero The amount of time remaining before the timer expires can also be read Ī value of zero indicates that the timer is stopped.Ī thread may read a timer’s status indirectly by synchronizing Reading a timer’s status resets its value to zero. The timer has expired since its status was last read. If a thread is waiting on the timer, it continues waiting.Ī timer’s status can be read directly at any time to determine how many times Using the new duration and period values specified by the caller. The timer’s status is reset to zero, then the timer begins counting down ![]() The timer’s status is left unchanged, then the timer enters the stopped stateĪnd executes its stop function, if one exists.Īttempting to stop a non-running timer is permitted,īut has no effect on the timer since it is already stopped.Ī running timer can be restarted in mid-countdown, if desired. Otherwise the timer restarts with a new duration equal to its period.Ī running timer can be stopped in mid-countdown, if desired. If the timer’s period is zero the timer enters the stopped state If a thread is waiting on the timer, it is unblocked. When a running timer expires its status is incrementedĪnd the timer executes its expiry function, if one exists It is possible that more time may have passed as measured by readsįrom the relevant system time APIs. Precision (and potentially runtime interactions like interrupt delay) Note that the timer’s duration and period parameters specify The running state and begins counting down towards expiry. The timer’s status is reset to zero, then the timer enters This specifies itsĮxpiry function and stop function values, sets the timer’s status to zero,Īnd puts the timer into the stopped state.Ī timer is started by specifying a duration and a period. If no stop function is required a NULL function can be specified.Ī status value that indicates how many times the timer has expiredĪ timer must be initialized before it can be used. The function is executed by the thread that stops the timer. If no expiry function is required a NULL function can be specified.Ī stop function that is executed if the timer is stopped prematurely The function is executed by the system clock interrupt handler. With a duration of 200 and a period of 75, it will first expireĪfter 200ms and then every 75ms after that.)Īn expiry function that is executed each time the timer expires. K_FOREVER means that the timer is a one shot timer that stopsĪfter a single expiration. This is a k_timeout_t value thatĪ period specifying the time interval between all timerĮxpirations after the first one, also a k_timeout_t. Each timerĪ timer has the following key properties:Ī duration specifying the time interval before the timerĮxpires for the first time. ![]() Scheduling, Interrupts, and SynchronizationĪny number of timers can be defined (limited only by available RAM).Document Release Versions latest 3.0.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 1.14.1 Downloads PDF Links Project Home SDK Releases
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |