1
00:00:00,900 --> 00:00:01,980
Hello, welcome back.

2
00:00:02,190 --> 00:00:04,230
In this lesson, we should talk about soft.

3
00:00:04,290 --> 00:00:05,040
What time is?

4
00:00:06,500 --> 00:00:14,450
Software timers are used to schedule the execution of a function at a set time in the future or periodically

5
00:00:14,450 --> 00:00:22,230
with a fixed frequency, the function executed by the software timer is called the software time as

6
00:00:22,230 --> 00:00:23,240
a callback function.

7
00:00:24,160 --> 00:00:29,350
This time is different from our hardware, time is such as time.

8
00:00:29,420 --> 00:00:30,910
One, two, three, etc..

9
00:00:31,210 --> 00:00:35,620
These timers are implemented under the control of the artist Toscano.

10
00:00:35,800 --> 00:00:41,290
They do not require hardware support and are not related to the hardware timers.

11
00:00:41,980 --> 00:00:49,570
So to use this time as we have to go to our free Archos config that each file and sets config use underscore

12
00:00:49,570 --> 00:00:53,950
time is to one before we are able to use this time in our project.

13
00:00:55,330 --> 00:01:02,290
So there are two types, the risk, the auto reload time out and the one short timer, the auto reload

14
00:01:02,290 --> 00:01:07,150
time out once we started it would restart itself after it expires.

15
00:01:07,450 --> 00:01:11,320
And this result in a periodic execution of its callback function.

16
00:01:11,890 --> 00:01:19,210
And the one shot timer when we restarted and it's execute its callback function was in its expires.

17
00:01:19,460 --> 00:01:21,310
It doesn't restart itself.

18
00:01:21,850 --> 00:01:23,940
We have to manually restarted.

19
00:01:23,980 --> 00:01:26,080
That is why it is called one short.

20
00:01:27,720 --> 00:01:33,930
The key parameter when talking about these times is the period, the period is the time between the

21
00:01:33,930 --> 00:01:39,390
software time are being started and the software time as a callback function executing.

22
00:01:39,690 --> 00:01:46,650
So this time period is quite a period of time between starting the timer and executing the time as a

23
00:01:46,650 --> 00:01:47,530
callback function.

24
00:01:47,850 --> 00:01:50,910
It's known as the period the timer has to state.

25
00:01:50,910 --> 00:01:55,100
It has the dormant state and the running states in the dormant state.

26
00:01:55,110 --> 00:01:58,830
The callback function does not execute in the running states.

27
00:01:59,520 --> 00:02:01,740
The callback function is being executed.

28
00:02:02,220 --> 00:02:04,260
So we can look at the state diagram.

29
00:02:05,130 --> 00:02:11,300
This state diagram here represented to the state of the auto reload timer.

30
00:02:11,580 --> 00:02:16,680
So when the time is created, as you can see in this diagram, it's in the Dormont State.

31
00:02:16,950 --> 00:02:23,340
We can call the time I start the next time I restart or the next time I change period to move.

32
00:02:23,340 --> 00:02:26,400
The time when we call any of these functions.

33
00:02:26,640 --> 00:02:32,880
The timer moves from the dormant state to the run in the state, in the auto reload case when the timer

34
00:02:32,880 --> 00:02:39,220
expires in the running state, still remains in the running state to reload itself.

35
00:02:39,870 --> 00:02:46,110
However, when we call the next time I stop, that is when the timer moves from the running state back

36
00:02:46,110 --> 00:02:47,160
to the dormant state.

37
00:02:48,680 --> 00:02:54,530
This is the version for the wine short timer who created the timer, the timer starts in the domain

38
00:02:54,550 --> 00:02:55,030
state.

39
00:02:55,070 --> 00:02:59,350
We can move the timer from Dorman's to running by calling either Eckstut.

40
00:02:59,630 --> 00:03:04,220
Next time I start, next time I restart or reset, it should be.

41
00:03:04,430 --> 00:03:08,590
And then when we also change the timer period, it moves to the running stage.

42
00:03:08,890 --> 00:03:14,330
However, over here there are two things that move the timer from the running state to the Domar state.

43
00:03:14,630 --> 00:03:18,340
When the timer expires, it automatically moves the dormant state.

44
00:03:18,350 --> 00:03:19,000
That is one.

45
00:03:19,190 --> 00:03:25,190
The second thing is when we call the time a stop function, the timer would move to the dormant state.

46
00:03:26,960 --> 00:03:31,640
So let's see some commonly used APIs when we're dealing with a wire timer.

47
00:03:32,750 --> 00:03:38,450
OK, so we have the X time to create this function is used to create a timer.

48
00:03:38,480 --> 00:03:40,640
It takes five arguments.

49
00:03:40,640 --> 00:03:41,750
As you can see over here.

50
00:03:41,750 --> 00:03:45,710
The first argument is just a readable name that we can give the timer.

51
00:03:45,890 --> 00:03:49,310
And a second argument is the the period.

52
00:03:50,060 --> 00:03:54,860
And then the third argument allows us to indicate whether we want to set or reload.

53
00:03:54,860 --> 00:03:59,270
True or false, if we said is to force, it will become a Y short time.

54
00:03:59,270 --> 00:04:06,470
If we said is to true, then it becomes an auto reload timer and then over here we give it a timer on

55
00:04:06,470 --> 00:04:09,980
it and then the callback function that the time I should execute.

56
00:04:10,490 --> 00:04:11,600
So these are the argument.

57
00:04:11,630 --> 00:04:13,070
We'll see how it is done in code.

58
00:04:14,560 --> 00:04:19,850
And also, there is the next time I start to function, this function is used to start the timer.

59
00:04:20,170 --> 00:04:27,610
It just takes the time of Handler's argument and then we can give a wait time, how much time we should

60
00:04:27,610 --> 00:04:30,760
wait for this function to execute X to wait.

61
00:04:31,030 --> 00:04:36,660
OK, and then we have the the functions for dealing with the time.

62
00:04:37,150 --> 00:04:43,390
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.

63
00:04:44,350 --> 00:04:52,210
Right, so they saw the race for timers, so let's go ahead and write some practical code using our

64
00:04:52,210 --> 00:04:54,280
software, telling us I'll see you the next lesson.
