Hello, welcome back.
In this lesson, we go in to develop the GPA, you extend or interrupt driver, I'm going to come to
my source folder here, right.
Click New Hour Select.
Sourcefire, I'll call this t'ai.
Lozzi.
OK.
We have this file.
OK, I'm going to create the head of our include folder, right click new head of file.
Quota's.
Dorridge.
OK.
So we're going to have one function.
Remember, on our nuclear board, the push button is connected to PC 13.
Pottsy, been 13, has the the push pushbutton.
So to start off, I'm going to include our whole lot each over here.
And once that is done, I'm going to create a function here.
Void this 13.
Entrapped in it, and this time I'm not going to show how to ride this driver, I'm just going to explain
line by line, because this course is not for developing bedmate or driver's.
OK, so we're going to start off by enabling access to your ports seat to do that, we need to access
the HP one enable register and then when we write four, it would correspond to bits.
Number two, that corresponds to Port C.
Four equals binary number.
Zero one zero zero, so it's No zero bids, no one bids, no two bids, No.
Zero is for Porti, this one is for Port B, this is for Port C, OK, so that is why I write for OK,
every now and then I'm tempted to explain more.
OK, also because we want to enable, extend or interrupt, and what extend or interrupt means is that
we're not going to be checking the Penn State to see whether someone has pressed it or not.
When someone presses the pin, we're going to be told automatically that's what this means.
So because we're going to we want this functionality, we have to enable the system config, which is
another module that handles our external interrupts.
So our Anabasis config over here, that is part of the APB to bus.
So I go to AP to enable and this hexadecimal code.
When I expand it to its binary form, it would correspond to the bit that enables this config for us.
So once that is done, we go into Configure PC 13, which is where our push button is connected.
We're going to set PC 13 to its alternate function mode.
We're going to configure it for its.
It's input's mood.
Inputs in Robert mode, essentially, so to do that.
Let's go to our reference manual, because this bits I need to point it out to you.
I'll come up here and I'll search you, and then I'm going to scroll down.
OK, I jumped over here.
GPA, you must register.
So for input, we have to set this particular bit.
We have to set a particular pin to zero zero, remember, in the Mod Register, two bits are used for
a single pin.
So we're dealing with PIN 13 pieces, 13.
So we're looking for Modder 13.
Over here, so we have to set.
Twenty six and bid twenty seven to zero.
OK, what we can do is use the end operator to disable just these bits.
Right, so I can simply do that.
By using this.
If I expand this hexadecimal number, it corresponds to bits number twenty six and twenty seven, the
bits we are interested in, right.
And if I put a two day here and then I put an end here, it means sets between twenty six and twenty
seven in mode register to zero zero for me.
So that's what this means.
OK, once that's done we're going to play the part selection for our external interruptive 13 because
we're using PK 13.
So this is what we do.
We access this as config register and then we select this.
Once we've cleared it, then we're going to select PK 13.
Like I said this bit, I'm not going to elaborate.
OK, and then once that is done, we unmask PK 13 like this.
And then we're going to see that we want to detect falling trigger, we can detect in a rising age or
a fall in edge, we want to say we want to detect fall in edge.
So we said this are with this value.
Once that is done, we can set the priority of this interrupt.
I'm going to set it to priority six and I'm going to enable the interrupt over here again.
If you want to learn more about this, there's a specialized course.
I don't want you to come to me in the review or comment section telling me that I didn't explain this
bit.
Yes.
Before this lesson, I said I wasn't going to explain this bit thoroughly.
Right.
Because there is a dedicated course.
What a bit.
OK, so traditionally or ordinarily, what I should have done is just uploaded of the file here called
I don't see and told you download this file in order to a project.
But I think that is more cryptic.
Initially we went to the reference module to develop the the ATC one a bit.
So now we need no go and look at each and every register and I need to explain each and every value
because this is not a bare metal peripheral development course.
So just bear with me, OK?
After this runs, we can proceed.
So we have to expose this to our.
We have to expose this in a vault, so I'll copy this.
And paste this over here.
OK, controllers to save, controllers to save, and then let's build and see if there are any errors,
I'm going to include adults age as well as adequate age.
Yeah, you know, I may not see faults also include.
XDA.
The rich.
Include ADC storage.
OK, we have a bit of error.
See?
It's located in our ADC, Forelady Sidoti.
What does it say?
It says these are undeclared.
It cannot locate the ADC data register.
Of course, I forgot the arrow head as the arrow operator supposed to be, so let's click to build.
OK, so it's built it's built successfully in the next lesson, we're going to test the drivers, we're
going to test the ADC and the external enwrapped together.
So I'll conclude you.
I'll see you later.
If you have any questions, leave them in the questions and answers area.
See you.