Hello.
Welcome back.
So in this lesson we're going to ball task Creighton.
We're going to create tasks from scratch.
And in this lesson we're going to create four tasks.
These tasks are going to manage four entities on the Discovery board.
So let's get ahead with it.
I'll just quit Project Uplift project and come over here and I'm going to create a new folder.
Call this number one and I'll call this task of creation
and then I'm going to call the project to task
on the school charging my board.
Assume that's 2 4 1 1.
I select click OK and on The Simpsons I need to call on the device and it starts up because we're using
the LCD.
We need the estimates to keep the framework classic over here like this.
I click it to resolve.
Then I just minimize this.
And then under artist I select three answers.
And then with free answers I select to buy here under config I choose free actors.
Then a clue to the files I want.
I want a config file I want to call.
I want it before we can change the heat.
If we want to let's just stick with it for for a while and then select time as we might use time as
I click OK.
That is set and I'm going to change the target to make to the name of my target as.
That's 2 4 1 1
overhead.
I just this to compete and I'm going to create a new file called the main
main see and I just set up my target my barcodes the SD link Barker on the settings I select flushed
out i click over here reset and right click Okay.
Then that flies on the target.
Sorry about this optimize my excel by saying it's 16 megahertz this the default external value of my
microcontroller.
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
arbiters of age and then we need the task H which is part of the free.
Our test files for this right click include files and then over here is tempted to F for exits although
H then why click again include file three artists H and then right click again include files task the
edge like this so I'll just move on with initialize into entities so like we did it now gets and starts
at Project we we created created symbolic names for our early days I'll just bring all of that here
like this.
This is just redefining the entities on the board a 12th year is for Queen entity thirteen is for or
range fourteen is for Red fifteen is complete so whenever we need to toggle these pins we just use these
names.
This what this does is once that is done I'll just bring the routine for initialize and the entity before
I do that I'll just put my intimate close the throttle usual not to have main so used to the main
and I can break my unit here you pay it sorry and then I just copy and I call the prototype up nice
and clean and once we've done this next thing we need to do is just come over here and then initialize
the UK patents just by calling the GPL it's declared like this and once we get to this stage all we
have to do is use our X task create API and then creates default tasks and then creates the task function
for the task and then just run the experiment right.
So from that gets and started projects like you to post this video and see if you can run this experiment
on your own positive video try to create four tasks each task talking with the entity each entity on
the board and let's see how you do it give all tasks the same priority so I'm gonna post to feed you
and expect you to pull shows it might take you about ten minutes to complete that then let's see
right I'm sure you cried out just trust you did so once you've tried to see what we can come up with
so we use the x tiles create API so I start by just taking x task create like this and as we saw earlier
this API your function takes six argument and this time we're going to write the arguments that's going
to write the argument basically like this this is much more readable and it makes it easier to understand
once our project begins to increase in size the first task is going to be the plurality controller.
So the way to write this is to start with field because its returns are void remember tasks functions
return a void and we name we named functions and free artists according to what a return.
So V gets for voice I'm going to call this task function the B O U for blue blue D controller task like
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
blue controller very descriptive
Cruella right.
And then I'm going to give it a tax size.
I'm going to give it one concrete over here like this.
And then once that is done in this project we're not passing in it parameters to the task function.
So I'm just going to put it not over here.
This is cops.
I'm going to assign a task a priority of one shot at one over here like this.
And for now we don't need to create a condo for this task.
So I'm going to put it now as well.
So we've created this task.
All we need to do to complete this task is to ask the task function to it.
So write it on you know type in an increase in the typing noise or just copy and paste this and rename
it for the other tasks come here.
And this is going to be for the read.
This next one will be for the orange and this last one which I'll put here would be for the green.
So I can just come over here and change the respective colors.
This is going to be red.
It's going to be orange.
This green
and I can just change the descriptive names we gave the task.
We read
arranged
and then green with added more Q the same priority from now.
Now to know once we've once we've created tasks we need to create the task function for each task.
Now I'm going to do it down here.
Just keep everything clean and then once it's done I'll declare the prototypes up there to make it reachable
so task functions return a void and start with the first blue to show you what I mean and I'll just
copy the name of a task function forward type A mistake is and then argument is Floyd stop TV from each
year.
This
would put a wall like this
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
GPA or let's call Tokyo chalk or pen and the ports.
Keep Dee Dee Dee and I need to just leave it like this and we can create our pseudo delay here we can
see for all you've caught zero and let's see seven hundred thousand I this less than seven hundred thousand
will create precise delays later for these experiments we just take things step by step plus plus and
then we just let us do nothing and we create the local variable tied up here like this and the task
function is complete to what I have to do now is just create the task function for red orange and green
and I can just simply do it by duplicating this why and renaming it one two three four I hear the word
cloud becomes red I hear the word blue becomes orange
and of course overhead it becomes green
we can change the L.A. colors.
So this one is totally empty.
This one is totally in red.
Third point is to quit talking and arrange things like this.
And this fourth one is totally in green
suit.
No no we're finished declaring task functions.
We just need to put out prototypes up there.
I'm just going to grab the prototype of this and then rename it put it up here.
One two three four.
Then I put a call on her something called me called on and then some calls and this becomes
red
range
for green.
Yeah we forgot the semicolon for a law toss create function.
So we just the same lunch here.
So like I said this is much more readable.
So everything is set with the tasks we've initialized the GPL pins and we've created a task functions
as well.
All we need to do is start the schedule on how we use the V task start scheduler.
Come here.
Talks start.
Should look like this.
Yeah.
And we can just keep our empty world while the main function
right we set.
So all I need to do now is build my project and once this is done I just click here to download onto
my port and as you can see all these uplink.
So this is it.
This is task creation we've created four tasks.
If I assign them all the same stack size and the same priority cost at all with the same priority there's
a bit of time sharing going on among them.
So that's all there is for this project and I shall see you in the next lesson.