1
00:00:00,830 --> 00:00:08,080
Hello, welcome back and listen, we'll see how to work with event flux using our Simms's artist Apeace.

2
00:00:08,390 --> 00:00:11,000
I'm going to make a copy of our last project over here.

3
00:00:11,030 --> 00:00:13,520
The last project was the message Kyuss.

4
00:00:14,460 --> 00:00:15,330
I'll copy this.

5
00:00:16,480 --> 00:00:17,910
And paste over here.

6
00:00:20,160 --> 00:00:22,500
And then I call this 45.

7
00:00:24,980 --> 00:00:25,900
Events, flags.

8
00:00:33,610 --> 00:00:34,330
It's karpin.

9
00:00:36,000 --> 00:00:38,220
And we are here, this is forty five.

10
00:00:39,250 --> 00:00:40,300
Going to expand it.

11
00:00:42,510 --> 00:00:44,110
And then over here.

12
00:00:44,240 --> 00:00:45,840
So may not see.

13
00:00:52,460 --> 00:01:00,320
So less so this project we've made copies of previous project, we have SEMAFO stuff, Taimur stuff,

14
00:01:00,320 --> 00:01:03,170
as well as our work stuff, we're going to.

15
00:01:04,200 --> 00:01:10,260
Delete the QR code, the code for the Q we have in our task functions in our last project, we saw how

16
00:01:10,260 --> 00:01:12,060
to send data using cues.

17
00:01:12,400 --> 00:01:13,780
So I'm going to delete this.

18
00:01:13,780 --> 00:01:22,800
Q sent and then the print message associated with a Q from a blue task and then the Q send was being

19
00:01:22,800 --> 00:01:24,750
done from our red alert task.

20
00:01:25,050 --> 00:01:28,530
I'm going to delete that as well so we can use our task functions.

21
00:01:28,920 --> 00:01:32,400
We simply have four tasks and they all have the same priority.

22
00:01:32,850 --> 00:01:36,630
So let's go to our documentation and see how we would work with event flags.

23
00:01:38,510 --> 00:01:40,400
So this is all documentation.

24
00:01:41,300 --> 00:01:45,140
I'm going to click event flux over here to see what we have.

25
00:01:46,050 --> 00:01:48,300
OK, so event flags.

26
00:01:49,670 --> 00:01:52,200
This flag has an attribute structure as well.

27
00:01:52,220 --> 00:01:58,290
So just like our task semaphore and the rest, we have to define the attribute structure for events,

28
00:01:58,290 --> 00:02:00,620
flag the see the functions we have.

29
00:02:00,830 --> 00:02:02,650
We have always event for like new.

30
00:02:02,660 --> 00:02:09,320
And this takes the attributes point to a segment discrete and initializes an event flag and we have

31
00:02:09,320 --> 00:02:14,560
one to set the event flag, one to clear the event flag to get to, to delete.

32
00:02:14,840 --> 00:02:20,810
OK, so let's declare the attribute structure for events like we're going to use just one member of

33
00:02:20,810 --> 00:02:22,190
this structure, which is the name.

34
00:02:22,610 --> 00:02:23,840
So we're going to.

35
00:02:24,920 --> 00:02:31,160
First of all, declare an ad for the event of like we shall create, we call this lesse.

36
00:02:34,100 --> 00:02:43,390
We call this event like we created a variable of type who has events like we call indescribable events

37
00:02:43,400 --> 00:02:49,100
like Alyda, once that is done, we're going to create a structure and attribute structure over here.

38
00:02:49,970 --> 00:02:52,580
We call in this event flug year.

39
00:02:53,600 --> 00:02:56,750
And this is of type of event like attribute structure.

40
00:02:56,750 --> 00:02:58,570
And then we're using just the name field.

41
00:02:58,940 --> 00:03:01,450
We set in the name over here to event floods.

42
00:03:01,910 --> 00:03:08,460
Once that is done, we're going to create a new event flag and the function is always events, flags,

43
00:03:08,690 --> 00:03:13,700
new, and it takes the attributes as argument to come over here.

44
00:03:13,730 --> 00:03:18,380
Once we've initialized our volcano, we create a new event flag and then.

45
00:03:19,870 --> 00:03:24,760
The handle returned or the ID is going to be stored in our I.T. variable over here.

46
00:03:26,730 --> 00:03:27,270
OK.

47
00:03:28,640 --> 00:03:33,080
So that is it, so next, we agreed to make use of our events like so.

48
00:03:34,160 --> 00:03:35,600
We agreed to let one of.

49
00:03:36,470 --> 00:03:37,270
Our task.

50
00:03:39,090 --> 00:03:46,890
So we're going to let one of our tasks, this task is going to set a particular event flag and then

51
00:03:46,890 --> 00:03:50,240
we're going to wait for this particular event flag in another task.

52
00:03:50,670 --> 00:03:56,610
So the red flag we're going to set, we going to set the flag over here.

53
00:03:56,610 --> 00:03:59,310
The flag is a hexadecimal code.

54
00:03:59,790 --> 00:04:02,160
So we're going to set zero zero one.

55
00:04:02,520 --> 00:04:10,310
And then we expect or we wait for this in the blue led task force over here in the red ality task,

56
00:04:10,680 --> 00:04:12,060
I'll see events flag.

57
00:04:14,800 --> 00:04:16,240
And then I'll call the.

58
00:04:17,330 --> 00:04:18,110
Sorry about that.

59
00:04:21,370 --> 00:04:27,000
The always flux sets and then I passed the idea of the events flag and the flag over here.

60
00:04:27,920 --> 00:04:30,020
OK, so the flag is the actual one.

61
00:04:31,090 --> 00:04:36,810
Right, so now I'm going to come to our plurality's task and wait for this flag.

62
00:04:37,800 --> 00:04:43,050
So I'm going to call the U.S. flag wait function over here.

63
00:04:44,600 --> 00:04:50,880
So the first argument is the events like the second argument is the flag and then.

64
00:04:51,920 --> 00:04:57,260
This one here, this the documents indicate whether we want to wait for any of the flags or the single

65
00:04:57,260 --> 00:05:00,690
flag, you see any of the flag and over here wait forever.

66
00:05:00,980 --> 00:05:02,650
Remember, we can combine flags.

67
00:05:02,690 --> 00:05:04,490
We saw events, bits and event groups.

68
00:05:04,700 --> 00:05:07,220
We can combine combine them over here.

69
00:05:07,220 --> 00:05:08,210
We see any of them.

70
00:05:08,630 --> 00:05:12,200
OK, let me show you what I mean when we go to the documentation.

71
00:05:13,880 --> 00:05:16,160
And we go to always like, wait.

72
00:05:17,860 --> 00:05:24,250
It explains further, it tells us flaks, meaning we can wait for multiple flags, specify.

73
00:05:25,130 --> 00:05:27,770
The second argument specifies the flags to wait for.

74
00:05:28,970 --> 00:05:31,190
And then specifies the flex option.

75
00:05:32,930 --> 00:05:33,820
Options here.

76
00:05:36,020 --> 00:05:38,220
Specifies the flux option.

77
00:05:38,750 --> 00:05:44,750
So over here, we are specifying a single flag to wait for zero zero one and then over here, the options

78
00:05:44,750 --> 00:05:50,180
we see in wait for any dysfunction function, always flag wait suspends the execution of the currently

79
00:05:50,180 --> 00:05:58,940
running thread onto any or all event flag specified in the parameter flags onto any or all specified

80
00:05:58,940 --> 00:06:05,080
in flags in the event object specified by parameter F ID.

81
00:06:06,100 --> 00:06:11,680
Which is the idea for the event flag is set, so over here we are saying wait for any of the flags and

82
00:06:11,680 --> 00:06:13,660
we know we have a single one, so that is fine.

83
00:06:13,660 --> 00:06:17,860
If we had multiple ones, we could still say wait for any or wait for all.

84
00:06:18,760 --> 00:06:20,440
So over here, the options.

85
00:06:21,070 --> 00:06:27,640
Yeah, we can see always like wait any wait for any of the flights, this the default always flags wait

86
00:06:27,640 --> 00:06:29,230
or waits for all of the flags.

87
00:06:30,220 --> 00:06:34,060
And we have always flags, no clear do not clear flags which have been specified.

88
00:06:34,240 --> 00:06:42,910
OK, so we've seen anyone any over here and over here wouldn't have any significance or you wouldn't

89
00:06:42,910 --> 00:06:45,610
have any effect at all because we have a single flag we're dealing with.

90
00:06:45,950 --> 00:06:52,420
OK, so once we receive this flag, we want to print out a message when a print this is blue to ask.

91
00:06:53,310 --> 00:06:56,100
OK, let's build and see what we have.

92
00:06:57,930 --> 00:06:59,400
I'll click over here to build.

93
00:07:05,010 --> 00:07:05,700
It's building.

94
00:07:09,570 --> 00:07:10,500
It's still in.

95
00:07:12,600 --> 00:07:13,650
It's finished building.

96
00:07:16,470 --> 00:07:17,400
Click here to run.

97
00:07:19,640 --> 00:07:23,240
Right, click runners, ASTM 30 to.

98
00:07:25,540 --> 00:07:26,110
And then.

99
00:07:28,500 --> 00:07:30,510
Select forty five events like.

100
00:07:34,190 --> 00:07:35,540
If you stop running, no.

101
00:07:40,540 --> 00:07:42,610
I computer's running slow now.

102
00:07:42,940 --> 00:07:45,190
OK, click OK over here.

103
00:07:48,920 --> 00:07:49,760
And it's running.

104
00:07:51,240 --> 00:07:53,760
OK, it's finished downloading onto the board.

105
00:07:53,940 --> 00:07:55,860
Let's see where is real, Tim?

106
00:07:58,310 --> 00:07:59,360
I'm going to clear this.

107
00:08:02,800 --> 00:08:08,290
And of course, this where we have this is blue task, so the events flag is being received.

108
00:08:08,500 --> 00:08:11,940
How do we know indeed this is the events flag making this.

109
00:08:11,950 --> 00:08:12,460
Bring this.

110
00:08:13,510 --> 00:08:19,120
I'm going to comment out the bits where we set the event flag and then we just wait for this event to

111
00:08:19,120 --> 00:08:20,230
flag without setting it.

112
00:08:20,470 --> 00:08:22,300
So I'm going to put a comment here.

113
00:08:23,210 --> 00:08:24,470
And then do it again.

114
00:08:27,300 --> 00:08:32,640
And just so you know, you see we have this arrest line here, meaning we are receiving data.

115
00:08:33,550 --> 00:08:37,870
We are building after that, we're going to click here to download onto the board and we expect the

116
00:08:37,880 --> 00:08:42,160
Erich's line to stop blinking and we expect this to stop moving.

117
00:08:42,800 --> 00:08:43,350
OK.

118
00:08:46,180 --> 00:08:48,970
It's done building, so I'm going to click here to run.

119
00:08:56,840 --> 00:08:58,370
It's downloaded onto the board.

120
00:09:06,980 --> 00:09:11,820
It's downloaded, it's done now, as you can see, we're no longer receiving any data.

121
00:09:11,840 --> 00:09:14,030
There's no our line blinking here.

122
00:09:14,180 --> 00:09:17,300
And this is this is stuck.

123
00:09:17,310 --> 00:09:20,870
If I clear it, it is stuck if I press reset on my board.

124
00:09:22,180 --> 00:09:23,920
Nothing happens, right?

125
00:09:24,850 --> 00:09:25,380
OK.

126
00:09:27,170 --> 00:09:28,000
So that is it.

127
00:09:28,340 --> 00:09:35,030
I see, yes, nothing is supposed to happen in this one, we're not printing system initialise, so

128
00:09:35,030 --> 00:09:36,170
we don't expect to see that.

129
00:09:36,680 --> 00:09:38,770
So this is how events, flags work.

130
00:09:39,080 --> 00:09:40,280
This is just an overview.

131
00:09:40,280 --> 00:09:46,460
Of course, we've not we've not gone deeply into this systems, ARTUS, but I've just shown you how

132
00:09:46,460 --> 00:09:52,100
easy it is to just go to the documentation and take the functions and then apply them so it will be

133
00:09:52,100 --> 00:09:59,690
up to you to go and build more complex stuff and use the the much more complex variations of these APIs

134
00:10:00,470 --> 00:10:03,160
by just visiting the documentation and making use of them.

135
00:10:03,290 --> 00:10:06,110
But this all there is also you have a nice day.
