1
00:00:00,660 --> 00:00:00,920
Hello.

2
00:00:01,060 --> 00:00:01,720
Welcome back.

3
00:00:01,720 --> 00:00:06,060
So in this lesson we're going to ball task Creighton.

4
00:00:06,160 --> 00:00:08,500
We're going to create tasks from scratch.

5
00:00:08,500 --> 00:00:11,860
And in this lesson we're going to create four tasks.

6
00:00:11,860 --> 00:00:18,000
These tasks are going to manage four entities on the Discovery board.

7
00:00:18,160 --> 00:00:19,610
So let's get ahead with it.

8
00:00:19,630 --> 00:00:26,060
I'll just quit Project Uplift project and come over here and I'm going to create a new folder.

9
00:00:26,110 --> 00:00:31,360
Call this number one and I'll call this task of creation

10
00:00:36,560 --> 00:00:39,560
and then I'm going to call the project to task

11
00:00:42,850 --> 00:00:46,590
on the school charging my board.

12
00:00:46,640 --> 00:00:49,480
Assume that's 2 4 1 1.

13
00:00:50,060 --> 00:01:02,550
I select click OK and on The Simpsons I need to call on the device and it starts up because we're using

14
00:01:02,560 --> 00:01:03,810
the LCD.

15
00:01:03,820 --> 00:01:09,160
We need the estimates to keep the framework classic over here like this.

16
00:01:09,410 --> 00:01:11,290
I click it to resolve.

17
00:01:11,290 --> 00:01:15,660
Then I just minimize this.

18
00:01:15,690 --> 00:01:18,870
And then under artist I select three answers.

19
00:01:18,960 --> 00:01:25,240
And then with free answers I select to buy here under config I choose free actors.

20
00:01:25,240 --> 00:01:26,940
Then a clue to the files I want.

21
00:01:26,940 --> 00:01:29,140
I want a config file I want to call.

22
00:01:29,320 --> 00:01:32,260
I want it before we can change the heat.

23
00:01:32,280 --> 00:01:39,800
If we want to let's just stick with it for for a while and then select time as we might use time as

24
00:01:40,010 --> 00:01:41,200
I click OK.

25
00:01:41,370 --> 00:01:47,880
That is set and I'm going to change the target to make to the name of my target as.

26
00:01:47,910 --> 00:01:49,830
That's 2 4 1 1

27
00:01:52,560 --> 00:01:53,270
overhead.

28
00:01:53,540 --> 00:01:58,870
I just this to compete and I'm going to create a new file called the main

29
00:02:01,630 --> 00:02:14,450
main see and I just set up my target my barcodes the SD link Barker on the settings I select flushed

30
00:02:14,450 --> 00:02:18,670
out i click over here reset and right click Okay.

31
00:02:19,070 --> 00:02:23,230
Then that flies on the target.

32
00:02:23,230 --> 00:02:32,720
Sorry about this optimize my excel by saying it's 16 megahertz this the default external value of my

33
00:02:32,720 --> 00:02:33,590
microcontroller.

34
00:02:33,590 --> 00:02:40,180
And then I just included the head of force we need we need SDM that's 2 F for how not h need a free

35
00:02:40,180 --> 00:02:45,160
arbiters of age and then we need the task H which is part of the free.

36
00:02:45,160 --> 00:02:54,890
Our test files for this right click include files and then over here is tempted to F for exits although

37
00:02:54,980 --> 00:03:06,070
H then why click again include file three artists H and then right click again include files task the

38
00:03:06,140 --> 00:03:15,080
edge like this so I'll just move on with initialize into entities so like we did it now gets and starts

39
00:03:15,080 --> 00:03:23,420
at Project we we created created symbolic names for our early days I'll just bring all of that here

40
00:03:23,450 --> 00:03:24,200
like this.

41
00:03:24,350 --> 00:03:32,850
This is just redefining the entities on the board a 12th year is for Queen entity thirteen is for or

42
00:03:32,860 --> 00:03:38,750
range fourteen is for Red fifteen is complete so whenever we need to toggle these pins we just use these

43
00:03:38,750 --> 00:03:39,140
names.

44
00:03:39,140 --> 00:03:49,040
This what this does is once that is done I'll just bring the routine for initialize and the entity before

45
00:03:49,040 --> 00:03:56,990
I do that I'll just put my intimate close the throttle usual not to have main so used to the main

46
00:04:04,230 --> 00:04:13,540
and I can break my unit here you pay it sorry and then I just copy and I call the prototype up nice

47
00:04:13,550 --> 00:04:21,670
and clean and once we've done this next thing we need to do is just come over here and then initialize

48
00:04:21,670 --> 00:04:30,820
the UK patents just by calling the GPL it's declared like this and once we get to this stage all we

49
00:04:30,820 --> 00:04:39,460
have to do is use our X task create API and then creates default tasks and then creates the task function

50
00:04:39,460 --> 00:04:44,090
for the task and then just run the experiment right.

51
00:04:44,950 --> 00:04:53,280
So from that gets and started projects like you to post this video and see if you can run this experiment

52
00:04:53,310 --> 00:05:00,530
on your own positive video try to create four tasks each task talking with the entity each entity on

53
00:05:00,530 --> 00:05:08,210
the board and let's see how you do it give all tasks the same priority so I'm gonna post to feed you

54
00:05:08,210 --> 00:05:13,640
and expect you to pull shows it might take you about ten minutes to complete that then let's see

55
00:05:17,430 --> 00:05:25,500
right I'm sure you cried out just trust you did so once you've tried to see what we can come up with

56
00:05:26,070 --> 00:05:36,930
so we use the x tiles create API so I start by just taking x task create like this and as we saw earlier

57
00:05:37,920 --> 00:05:44,840
this API your function takes six argument and this time we're going to write the arguments that's going

58
00:05:44,900 --> 00:05:50,160
to write the argument basically like this this is much more readable and it makes it easier to understand

59
00:05:50,250 --> 00:05:56,940
once our project begins to increase in size the first task is going to be the plurality controller.

60
00:05:57,300 --> 00:06:03,600
So the way to write this is to start with field because its returns are void remember tasks functions

61
00:06:03,600 --> 00:06:10,260
return a void and we name we named functions and free artists according to what a return.

62
00:06:10,410 --> 00:06:23,550
So V gets for voice I'm going to call this task function the B O U for blue blue D controller task like

63
00:06:23,550 --> 00:06:31,320
this and once that is done I'm going to give this task a name and the name of the task is going to be

64
00:06:31,320 --> 00:06:34,080
blue controller very descriptive

65
00:06:36,570 --> 00:06:38,840
Cruella right.

66
00:06:38,860 --> 00:06:41,160
And then I'm going to give it a tax size.

67
00:06:41,230 --> 00:06:45,940
I'm going to give it one concrete over here like this.

68
00:06:46,150 --> 00:06:51,970
And then once that is done in this project we're not passing in it parameters to the task function.

69
00:06:51,990 --> 00:06:54,380
So I'm just going to put it not over here.

70
00:06:54,400 --> 00:06:57,120
This is cops.

71
00:06:57,730 --> 00:07:03,510
I'm going to assign a task a priority of one shot at one over here like this.

72
00:07:03,660 --> 00:07:07,670
And for now we don't need to create a condo for this task.

73
00:07:07,680 --> 00:07:11,100
So I'm going to put it now as well.

74
00:07:12,960 --> 00:07:15,130
So we've created this task.

75
00:07:15,150 --> 00:07:20,040
All we need to do to complete this task is to ask the task function to it.

76
00:07:21,210 --> 00:07:28,050
So write it on you know type in an increase in the typing noise or just copy and paste this and rename

77
00:07:28,050 --> 00:07:31,380
it for the other tasks come here.

78
00:07:31,550 --> 00:07:34,820
And this is going to be for the read.

79
00:07:35,040 --> 00:07:41,880
This next one will be for the orange and this last one which I'll put here would be for the green.

80
00:07:42,090 --> 00:07:46,580
So I can just come over here and change the respective colors.

81
00:07:46,650 --> 00:07:51,730
This is going to be red.

82
00:07:52,580 --> 00:07:56,030
It's going to be orange.

83
00:07:56,300 --> 00:07:56,750
This green

84
00:08:00,330 --> 00:08:03,780
and I can just change the descriptive names we gave the task.

85
00:08:04,090 --> 00:08:04,730
We read

86
00:08:07,400 --> 00:08:07,830
arranged

87
00:08:10,600 --> 00:08:14,740
and then green with added more Q the same priority from now.

88
00:08:14,740 --> 00:08:23,060
Now to know once we've once we've created tasks we need to create the task function for each task.

89
00:08:23,060 --> 00:08:24,560
Now I'm going to do it down here.

90
00:08:24,560 --> 00:08:30,740
Just keep everything clean and then once it's done I'll declare the prototypes up there to make it reachable

91
00:08:30,980 --> 00:08:39,570
so task functions return a void and start with the first blue to show you what I mean and I'll just

92
00:08:39,570 --> 00:08:54,380
copy the name of a task function forward type A mistake is and then argument is Floyd stop TV from each

93
00:08:54,380 --> 00:08:56,440
year.

94
00:08:57,330 --> 00:08:57,720
This

95
00:09:02,390 --> 00:09:04,500
would put a wall like this

96
00:09:09,440 --> 00:09:17,390
and basically what we're going to do is we're going to talk to her so I could come and see on this score

97
00:09:17,390 --> 00:09:23,210
GPA or let's call Tokyo chalk or pen and the ports.

98
00:09:23,340 --> 00:09:35,480
Keep Dee Dee Dee and I need to just leave it like this and we can create our pseudo delay here we can

99
00:09:35,480 --> 00:09:47,270
see for all you've caught zero and let's see seven hundred thousand I this less than seven hundred thousand

100
00:09:48,400 --> 00:09:54,350
will create precise delays later for these experiments we just take things step by step plus plus and

101
00:09:54,350 --> 00:10:01,760
then we just let us do nothing and we create the local variable tied up here like this and the task

102
00:10:01,760 --> 00:10:08,270
function is complete to what I have to do now is just create the task function for red orange and green

103
00:10:08,270 --> 00:10:17,720
and I can just simply do it by duplicating this why and renaming it one two three four I hear the word

104
00:10:17,720 --> 00:10:23,570
cloud becomes red I hear the word blue becomes orange

105
00:10:26,620 --> 00:10:28,750
and of course overhead it becomes green

106
00:10:32,950 --> 00:10:35,660
we can change the L.A. colors.

107
00:10:35,660 --> 00:10:37,150
So this one is totally empty.

108
00:10:37,220 --> 00:10:41,320
This one is totally in red.

109
00:10:43,070 --> 00:10:48,550
Third point is to quit talking and arrange things like this.

110
00:10:48,550 --> 00:10:50,540
And this fourth one is totally in green

111
00:10:55,300 --> 00:10:56,100
suit.

112
00:10:56,380 --> 00:10:58,990
No no we're finished declaring task functions.

113
00:10:58,990 --> 00:11:00,970
We just need to put out prototypes up there.

114
00:11:01,000 --> 00:11:07,170
I'm just going to grab the prototype of this and then rename it put it up here.

115
00:11:07,660 --> 00:11:10,330
One two three four.

116
00:11:10,420 --> 00:11:17,500
Then I put a call on her something called me called on and then some calls and this becomes

117
00:11:21,820 --> 00:11:22,290
red

118
00:11:26,050 --> 00:11:26,680
range

119
00:11:32,210 --> 00:11:37,470
for green.

120
00:11:37,770 --> 00:11:42,070
Yeah we forgot the semicolon for a law toss create function.

121
00:11:42,300 --> 00:11:44,010
So we just the same lunch here.

122
00:11:45,260 --> 00:11:48,400
So like I said this is much more readable.

123
00:11:50,870 --> 00:12:00,090
So everything is set with the tasks we've initialized the GPL pins and we've created a task functions

124
00:12:00,110 --> 00:12:00,950
as well.

125
00:12:00,980 --> 00:12:06,670
All we need to do is start the schedule on how we use the V task start scheduler.

126
00:12:07,520 --> 00:12:08,150
Come here.

127
00:12:08,270 --> 00:12:10,210
Talks start.

128
00:12:11,570 --> 00:12:16,180
Should look like this.

129
00:12:16,890 --> 00:12:17,340
Yeah.

130
00:12:17,450 --> 00:12:23,490
And we can just keep our empty world while the main function

131
00:12:26,200 --> 00:12:27,540
right we set.

132
00:12:27,550 --> 00:12:35,440
So all I need to do now is build my project and once this is done I just click here to download onto

133
00:12:35,440 --> 00:12:40,550
my port and as you can see all these uplink.

134
00:12:40,960 --> 00:12:41,760
So this is it.

135
00:12:41,860 --> 00:12:45,300
This is task creation we've created four tasks.

136
00:12:45,400 --> 00:12:52,210
If I assign them all the same stack size and the same priority cost at all with the same priority there's

137
00:12:52,240 --> 00:12:55,810
a bit of time sharing going on among them.

138
00:12:56,050 --> 00:13:00,960
So that's all there is for this project and I shall see you in the next lesson.
