Hello, welcome back.
In this lesson, we should talk about soft.
What time is?
Software timers are used to schedule the execution of a function at a set time in the future or periodically
with a fixed frequency, the function executed by the software timer is called the software time as
a callback function.
This time is different from our hardware, time is such as time.
One, two, three, etc..
These timers are implemented under the control of the artist Toscano.
They do not require hardware support and are not related to the hardware timers.
So to use this time as we have to go to our free Archos config that each file and sets config use underscore
time is to one before we are able to use this time in our project.
So there are two types, the risk, the auto reload time out and the one short timer, the auto reload
time out once we started it would restart itself after it expires.
And this result in a periodic execution of its callback function.
And the one shot timer when we restarted and it's execute its callback function was in its expires.
It doesn't restart itself.
We have to manually restarted.
That is why it is called one short.
The key parameter when talking about these times is the period, the period is the time between the
software time are being started and the software time as a callback function executing.
So this time period is quite a period of time between starting the timer and executing the time as a
callback function.
It's known as the period the timer has to state.
It has the dormant state and the running states in the dormant state.
The callback function does not execute in the running states.
The callback function is being executed.
So we can look at the state diagram.
This state diagram here represented to the state of the auto reload timer.
So when the time is created, as you can see in this diagram, it's in the Dormont State.
We can call the time I start the next time I restart or the next time I change period to move.
The time when we call any of these functions.
The timer moves from the dormant state to the run in the state, in the auto reload case when the timer
expires in the running state, still remains in the running state to reload itself.
However, when we call the next time I stop, that is when the timer moves from the running state back
to the dormant state.
This is the version for the wine short timer who created the timer, the timer starts in the domain
state.
We can move the timer from Dorman's to running by calling either Eckstut.
Next time I start, next time I restart or reset, it should be.
And then when we also change the timer period, it moves to the running stage.
However, over here there are two things that move the timer from the running state to the Domar state.
When the timer expires, it automatically moves the dormant state.
That is one.
The second thing is when we call the time a stop function, the timer would move to the dormant state.
So let's see some commonly used APIs when we're dealing with a wire timer.
OK, so we have the X time to create this function is used to create a timer.
It takes five arguments.
As you can see over here.
The first argument is just a readable name that we can give the timer.
And a second argument is the the period.
And then the third argument allows us to indicate whether we want to set or reload.
True or false, if we said is to force, it will become a Y short time.
If we said is to true, then it becomes an auto reload timer and then over here we give it a timer on
it and then the callback function that the time I should execute.
So these are the argument.
We'll see how it is done in code.
And also, there is the next time I start to function, this function is used to start the timer.
It just takes the time of Handler's argument and then we can give a wait time, how much time we should
wait for this function to execute X to wait.
OK, and then we have the the functions for dealing with the time.
We can set the idea and we can read the idea and we'll see the use of it when we could in the timer.
Right, so they saw the race for timers, so let's go ahead and write some practical code using our
software, telling us I'll see you the next lesson.